Android how to Close an Activity Programatically

You need to call method finish(). Here is an example...
 Button nextActivity = (Button) findViewById(;
 nextActivity.setOnClickListener(new View.OnClickListener() {
  public void onClick(View view) {

   Bundle b = new Bundle();
   EditText myName = (EditText) findViewById(;
   b.putString("myName", myName.getText().toString());
   //Add the set of extended data to the intent and start it
   Intent intent = new Intent();

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.