dinesh707
dinesh707

Reputation: 12592

How to stop an Activity from parent Activity?

_alerts = new Intent(homeActivity,Alertss.class);
homeActivity.startActivity(_alerts);
...
...
...
homeActivity.stopService(_alerts);

I need to stop the Activity i created from the object where i created it. I tried it in the way above but it did not work. Can any one suggest me a way to do this.

Upvotes: 1

Views: 1325

Answers (1)

hackbod
hackbod

Reputation: 91331

You can use Activity.startActivityForResult() and then Activity.finishActivity() passing in the same result code you used for starting it.

However, this does sound like something that would be better done just as a Dialog.

Upvotes: 1

Related Questions