如何使用onPause() [英] how to use onPause()

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

问题描述

如何在 onPause()方法中更改从edittext加载的按钮文本



例如

 @覆盖
受保护 void onPause(){
按钮。的setText(text.getText()的toString());
super .onPause();}



所以当我按下后退按钮并重新启动应用程序时它没有更改按钮文本

表示更改未保存

解决方案

您必须自己保存设置然后将其恢复为Resume 。请参阅 http://developer.android.com/training/basics/activity-lifecycle/pausing.html [ ^ ]

how to change button text loaded from edittext while in onPause() method

for example

@Override
protected void onPause() {
	button.	setText(text.getText().toString());	
	super.onPause();}


so when I press back button and relaunch the app it does not changed the button text
mean the changed does not saved

解决方案

You have to save your settings yourself and then restore them onResume. See http://developer.android.com/training/basics/activity-lifecycle/pausing.html[^].


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

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