public class SampleAppActivity extends Activity implements OnClickListener{
/** Called when the activity is first created. */
private Button btn_go;
Button btn_next;
AlertDialog alertDialog;
EditText nw_name;
EditText nw_degn;
EditText nw_cmpy;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
nw_name = (EditText) findViewById(R.id.nw_name);
nw_degn = (EditText) findViewById(R.id.nw_degn);
nw_cmpy = (EditText) findViewById(R.id.nw_cmpy);
btn_next = (Button) findViewById(R.id.btn_next);
btn_go = (Button) findViewById(R.id.btn_go);
btn_next.setOnClickListener(this);
btn_go.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String name = (String) nw_name.getText().toString();
String degn = (String) nw_degn.getText().toString();
String cmpy = (String) nw_cmpy.getText().toString();
alertDialog = new AlertDialog.Builder(SampleAppActivity.this).create();
alertDialog.setTitle("Values");
alertDialog.setMessage("name : " + name + "\nDegn : " + degn + "\ncmpy : " + cmpy);
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alertDialog.show();
}
});
}
}
Just Refer: http://mobile.tutsplus.com/tutorials/android/android-sdk-alert/
No comments:
Post a Comment