1. Diah Permatasari's Avatar
    I have two checkboxes . pencil and book. And I have 1 textview to total:

    package apa.y;

    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.CheckBox;
    import android.widget.TextView;

    public class myprice extends Activity {
    /** Called when the activity is first created. */

    CheckBox book,pencil;
    TextView total;
    int sum=0;

    public void onCreate(Bundle savedInstanceState) {

    pencil = (CheckBox) findViewById(R.id.pencil);
    book = (CheckBox) findViewById(R.id.book);
    total = (TextView) findViewById(R.id.total);


    public void onClick(View v) {

    sum = 0;
    if (pencil.isChecked()) {sum += 10;}else{sum +=0;}
    if (book.isChecked()) sum += 5;else{sum +=0;}

    total.setText("Total: "+sum);

    } }

    but didnt work. . Help me peaseee
    05-13-2013 03:34 AM

Similar Threads

  1. Sprint to disable tethering in Android 2.2
    By clownberg in forum HTC EVO 4G
    Replies: 35
    Last Post: 10-16-2011, 04:57 AM
  2. Please help me to root my htc evo
    By forum_user_99 in forum HTC EVO 4G Rooting, ROMs, and Hacks
    Replies: 57
    Last Post: 12-23-2010, 09:05 PM
  3. can someone help me to mute system tones during call???? EPIC 4G
    By greenmuggy in forum Epic 4G Rooting, ROMs, and Hacks
    Replies: 0
    Last Post: 10-15-2010, 01:29 PM
  4. Can someone help me to flash my hero back to stock
    By saiyantwin in forum HTC Hero
    Replies: 6
    Last Post: 04-17-2010, 02:02 AM
  5. Voice to Text Features in Android on Moment?
    By robbies7897 in forum Samsung Moment
    Replies: 2
    Last Post: 03-21-2010, 05:54 PM