Sundeep
Sundeep

Reputation: 405

Finish an activity from other activity

I have called two activities as intent. One activity is loaded in background and another activity is called on top of that, by setting the theme 'dialog', so that it looks like a dialog. Now I need to finish the background activity when the dialog activity is finished.

can anybody suggest a way to accomplish this.

Thanks in advance. Sundeep.S.

Upvotes: 0

Views: 40

Answers (1)

Narendra Singh
Narendra Singh

Reputation: 4001

Override onRestart method of your first activity, and call finish() there, as shown below.

  @Override
  protected void onRestart() {
    // TODO Auto-generated method stub

    super.onRestart();

    finish();
  }

This may help you out, I guess.

Upvotes: 1

Related Questions