2021年1月3日星期日

Tap notification causes tabbed activity to select specific tab but only when app isn't already open. How to do this while app is active?

I want tapping on a notification to open my app AND select a specific tab. This works fine if the app isn't already open (thanks to this answer: Intent to open a specific tab of tabbed activity) ... but it does nothing if the app is already open. I put a call to my tab-selecting function in onResumeFragments but that doesn't get called in this case. Where/how would I call my tab-selecting function from tapping this notification when app is already open?

Here's how I'm getting the intended tab inside onResumeFragments:

public void selectIntendedTab() {      if (getIntent().hasExtra(OPEN_TAB_KEY)) {          tabs.getTabAt(getIntent().getIntExtra(OPEN_TAB_KEY, 0)).select();          getIntent().removeExtra(OPEN_TAB_KEY);      }  }  
https://stackoverflow.com/questions/65557190/tap-notification-causes-tabbed-activity-to-select-specific-tab-but-only-when-app January 04, 2021 at 11:05AM

没有评论:

发表评论