如何使用 onResume()? [英] How to use onResume()?

查看:69
本文介绍了如何使用 onResume()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能给我一个在 Android 中使用 onResume() 的例子?

另外,如果我想在另一个活动的执行结束时重新启动该活动,执行哪个方法——onCreate()onResume()?>

如果我想更新数据,我如何把它放在 onResume() 中?

解决方案

任何重新启动的 Activity 都会首先执行其 onResume() 方法.

要使用此方法,请执行以下操作:

@Override公共无效 onResume(){super.onResume();//把你的代码放在这里...}

Can anyone give me an example that uses onResume() in Android?

Also, if I want to restart the activity at the end of the execution of another, which method is executed—onCreate() or onResume()?

And if I want to update data, how do I put it in onResume()?

解决方案

Any Activity that restarts has its onResume() method executed first.

To use this method, do this:

@Override
public void onResume(){
    super.onResume();
    // put your code here...

}

这篇关于如何使用 onResume()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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