本文介绍了获取额外的单实例模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想提出一些额外的与putextras(,)的通知,
但我的活动在单实例模式和OnResume我不能得到任何附加功能。
我该如何解决这个问题?
I want to put some extras with putextras(,) in notification , but my activity is in Single Instance Mode and in OnResume I can not get any extras .how can I solve this problem ?
intent.putExtra("keyboard", false);
//
if (getIntent().hasExtra("keyboard")) {
if (getIntent().getBooleanExtra("keyboard", true) == false) {
_HideKeyaboard();
}
}
我收到空的GET演员。
I receive null on get extras .
推荐答案
你的onSaveInstanceState可以保存数据。
onrestoreinstancestate可以检索。当活动继续暂停或恢复这些随时调用。
onsaveinstancestate you can save your data. onrestoreinstancestate you can retrieve. these always call when activity goes on pause or resume.
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
savedInstanceState.putExtra("keyboard", false);
super.onSaveInstanceState(savedInstanceState);
}
@Override
public void onRestoreInstanceState(Bundle outbundle) {
outbundle.getBooleanExtra("keyboard", true);
super.onSaveInstanceState(outbundle);
}
这篇关于获取额外的单实例模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!