Reputation: 1
I'm developing an app in Android
and need to implement a common app function- accepting numeric input from the user via a EditText
. After typing in this value, I want the user to be able to be select a 'go' button
. A result should then appear below the first TextView
. What should I use to display the result (TextView etc?) and how can I go about implementing this process. Thanks
Upvotes: 0
Views: 60
Reputation: 5707
You are new to this so First check d link http://www.tutorialspoint.com/android/android_event_handling.htm .
Here You have to define 1 TextView
, 1 EditText
and 1 Button
like
Button _go = (Button) findViewById(R.id._btngo);
than
_go.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TextView _getdata= (TextView) findViewById(R.id._tvresult);
EditText _result= (EditText) findViewById(R.id._etgetinput);
// get the input value and store as a string
String result = _result.getText().toString();
// display the result in textview
getdata.setText(result);
}
});
Hope you will find the solution .. :)
Upvotes: 1