OnClickListener error: Source not found

Posted by fordays on Stack Overflow See other posts from Stack Overflow or by fordays
Published on 2010-06-01T23:29:59Z Indexed on 2010/06/01 23:33 UTC
Read the original article Hit count: 251

Filed under:

Hi,

I'm brand new to Android development and right now I am building a simple calculator for healthcare workers. My program implements the OnClickListener class, but every time I click on the button to initiate the calculation, I get an error saying the "Source is not Found".

Here is the code:

public class KidneyeGFR extends Activity implements OnClickListener {



/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Calculate = (Button)this.findViewById(R.id.Calculate);
    Calculate.setOnClickListener(this);

}

public void onClick(View v) {
    if (Female.isChecked()) {
        gender = 0.742;
    }
    else {
        gender = 1.0;
    }
    if (African.isChecked()) {
        race = 1.212;
    }
    else {
        race = 1.0;
    }
    calculateBone();
}


protected void calculateBone() {
    int age = Integer.parseInt(EditAge.getText().toString());
    double serum = Double.parseDouble(EditSerum.getText().toString());
    finalgfr = BONECONST * Math.pow(serum, -1.154) * Math.pow(age, -0.203) * gender * race;
    BONEtext.setText(Double.toString(finalbone));
}

© Stack Overflow or respective owner

Related posts about android