如何重新启动在Android的活动? [英] how do I restart an activity in android?

查看:140
本文介绍了如何重新启动在Android的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我正在写一个应用程序,有它的一部分,可以让你改变窗帘设置。问题是,该设置将不会生效,直到活动被重新创建。有没有办法告诉应用程序使用onResume()方法来重新启动(希望允许它保存所有在的onSaveInstanceState())?

in an app that I am writing, there is a part of it that allows you to change a curtain setting. the problem is, that this setting won't take effect until the activity is recreated. is there a way to tell the app to restart using the onResume() method (hopefully allowing it to save everything in the onSaveInstanceState())?

推荐答案

这已经发布

Intent intent = getIntent();
finish();
startActivity(intent);

这篇关于如何重新启动在Android的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆