0
我設置前景調度,如:的Android保存在屏幕上旋轉前景派遣
mAdapter = NfcAdapter.getDefaultAdapter(this);
mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this,
getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
mFilters = new IntentFilter[] { new IntentFilter(
NfcAdapter.ACTION_TECH_DISCOVERED) };
// Setup a tech list for all NfcF tags
mTechLists = new String[][] { new String[] { MifareClassic.class
.getName() } };
,我有:
@Override
public void onResume() {
super.onResume();
mAdapter.enableForegroundDispatch(this, mPendingIntent, mFilters,
mTechLists);
}
但是,當屏幕旋轉前景調度結束調用公共無效onNewIntent(意向意圖) 。
我做錯了什麼?
當屏幕方向更改活動被破壞並重新創建時。 – Raghunandan
好吧,但....我只能調用onResume()行動enableForegroundDispatch(),所以...我必須做什麼來保存狀態或重新啓用ForegroundDispatch在屏幕上的旋轉? –
http://developer.android.com/guide/topics/resources/runtime-changes.html。檢查onSavedInstanceState()和onRetainInstanceState() – Raghunandan