开发者

How to stop an Activity from parent Activity?

开发者 https://www.devze.com 2023-03-09 07:34 出处:网络
_alerts = new Intent(homeActivity,Alertss.class); homeActivity.startActivity(_alerts); ... ... ... homeActivity.stopService(_alerts);
_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 开发者_StackOverflowin the way above but it did not work. Can any one suggest me a way to do this.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号