'Android 6.0+ Unable to resume activity , did not call finish() prior to onResume() completing
This my activity,no layout
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected void onStart() {
super.onStart();
}
@Override
protected void onResume() {
super.onResume();
if (getIntent().getAction().equals(NfcAdapter.ACTION_NDEF_DISCOVERED)) {
Parcelable[] rawMsgs = getIntent().getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
if (rawMsgs != null) {
NdefMessage[] msgs = new NdefMessage[rawMsgs.length];
for (int i = 0; i < rawMsgs.length; i++) {
msgs[i] = (NdefMessage) rawMsgs[i];
}
runNFCTagData(msgs[0].getRecords()[0].getPayload());
startActivity(new Intent(this, AlarmList.class));
} else {
Toast.makeText(this, getResources().getString(R.string.nfc_ndef_not_found), Toast.LENGTH_LONG).show();
}
}
}
Run it on android 6.0+ and it will be broken, you can see Unable to resume activity , did not call finish() prior to onResume()completing', but 6.0- is OK.I find a solution and it worked, but I don`t know why?
This is my solution @Override
protected void onStart() {
super.onStart();
setVisible(true);
}
Solution 1:[1]
You are using API > 21, so you can use the following style on your activity :
Theme.Translucent.NoTitleBar
The trick with "setVisible(true)" is still not needed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | tryp |
