
The above emulator image is just summing up the given two values and showing the result on the below textview which is on the same screen.
Here my need is i want to show only the result on another screen’s textview.How to achieve
this? what source i have to add on my source?
public class CheckingActivity extends Activity {
Button button1;
EditText txtbox1,txtbox2;
TextView tv;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txtbox1= (EditText) findViewById(R.id.editText1);
button1 = (Button) findViewById(R.id.button1);
tv = (TextView) findViewById(R.id.textView5);
txtbox2= (EditText) findViewById(R.id.editText2);
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
{
String a,b;
Integer vis;
a = txtbox1.getText().toString();
b = txtbox2.getText().toString();
vis = Integer.parseInt(a)+Integer.parseInt(b);
tv.setText(vis.toString());
}
});
Thanks a lot!.
1.) Replace your main activity with this:
3.) Add one xml layout file
resultview4.) Finally add in your manifest:
Hope it helps!!
EDIT