-1

I override onResume() in MainActivity and expecting it to be called when the app is resume. It does call the onResume as I checked on LogCat, but it didn't function properly as expected. Below is the method 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;
}

The LogCat only stop ad the Log.d line printing onResume() =>>>>>???. I expect the code will call the checkIntent and display the log inside the checkIntent method. but it doesn't.

Anyone can help?

yodann
  • 179
  • 1
  • 11

1 Answers1

0

Try putting super.onResume(); before the rest of the code

Quitlox
  • 46
  • 5