我在MainActivity中覆盖onResume()并期望在应用程序恢复时调用它。当我检查LogCat时它会调用onResume,但它没有按预期正常运行。 以下是onResume方法:
@Override
protected void onResume() {
Log.d(TAG, "onResume() =>>>>>???");
isNotified = checkIntent();
if (isNotified) {
try {
resetQuoteList();
resetViewPager(0);
} catch (TMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (adView != null) {
adView.resume();
}
super.onResume();
}
private boolean checkIntent() {
Intent checkIntent = getIntent();
String checkStr = checkIntent.getStringExtra(Intent.EXTRA_SUBJECT);
Log.d(TAG, "checkIntent() => checkStr=" + checkStr);
if (checkStr != null && checkStr.compareTo(DailyQuotes.NOTIFICATION_QOD_MODE) == 0) {
// means this is from notification QOD
Log.d(TAG, "This calling activity is from " + DailyQuotes.NOTIFICATION_QOD_MODE);
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
manager.cancel(DailyQuotes.NOTIFICATION_QOD_ID); // close notification
return true;
}
return false;
}
LogCat仅停止广告Log.d行打印onResume()=>>>>> ???。我希望代码将调用checkIntent并在checkIntent方法中显示日志。但它没有。
任何人都可以提供帮助吗?
答案 0 :(得分:0)
尝试使用super.onResume();在其余代码之前