I am Developing my first android Calculator app. I\'m stuck with a single defect. I have added few buttons and on clicking those buttons, it will put the respectives text on the
If you are calling your set1() method onClick of button in xml then you don't need to find ID for button in that method again. So simply it looks like,
public void set1(View v)
{
EditText tv = (EditText) findViewById(R.id.textView1);
String text=tv.getText().toString();
tv.setText(text+"1");
}
Now in your xml for button will be
android:onClick="set1"
Change your set1() method as follows,
public void set1(View v)
{
EditText tv = (EditText) findViewById(R.id.textView1);
String text=tv.getText().toString();
tv.setText(text+"1");
}