如何/什么在 Android 中使用 onResume() 或 onStart
我的应用程序包含 7 个活动。当它第一次安装在设备中时,我想显示所有活动。当应用程序关闭并稍后使用时,我希望隐藏特定的活动。如何解决这个问题?请帮我。如果我必须使用onResume
或onStart
,如何实现?
My app consists of 7 activities. For the first time when it has been installed in a device, I want to show all the activities. When the app has been closed and used later, I want a particular activity to be hidden. How to work out this? Please help me. If I have to use onResume
or onStart
, how to implement it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
第一次启动应用程序时,使用以下命令将布尔值(例如
isLaunched
)设置为true
putBoolean()< /a>,然后,当您启动应用程序时,如果 getBoolean of
isLaunched
为true
,不显示该特定 Activity。The first time your application is launched set a boolean values such as
isLaunched
totrue
usingputBoolean(), and then subsequently, when you launch the app, if getBoolean of
isLaunched
istrue
, don't show that particular Activity.在 Android 中一次只能显示一项活动。您想通过同时展示七项活动来实现什么目的?考虑使用 视图 而不是活动。有关活动的更多信息,请查看 Android活动生命周期(您必须滚动才能到达那里)。
You can only show one activity at a time in Android. What were you trying to accomplish by showing seven activities at once? Look into using Views instead of activities. For more information on activities, take a look at the Android Activity Lifecycle (you'll have to scroll to get there).