development environment - Android app losing backstack after going to sleep -


the problem:

  1. i intent new activity called missionactivity within mainactivity.
  2. i press home button.
  3. i return app after long period of time, application has start again.
  4. the app returns missionactivity using previously.
  5. if press arrow within toolbar, or press button closes app backstack lost (i think).

ideally, launch mainactivity after application gets killed. have read through android documentation , other questions on site. however, no matter change in android manifest, behavior doesn't seem affected.

here relevant portion of manifest. mainactivity intents missionactivity. guessing maybe have add launch modes? however, whatever try adding 1 doesn't seem change anything.

<application     android:name=".nextspaceflight"     android:allowbackup="true"     android:icon="@mipmap/ic_launcher"     android:label="@string/app_name"     android:supportsrtl="true"     android:theme="@style/apptheme">      <activity         android:name=".activities.mainactivity"         android:configchanges="orientation"         android:label="@string/app_name"         android:screenorientation="portrait"         android:theme="@style/apptheme.noactionbar">         <intent-filter>             <action android:name="android.intent.action.main" />              <category android:name="android.intent.category.launcher" />         </intent-filter>     </activity>      <activity         android:name=".activities.missionactivity"         android:label="mission"         android:screenorientation="portrait"         android:theme="@style/apptheme.noactionbar">          <meta-data             android:name="android.support.parent_activity"             android:value="com.nextspaceflight.android.nextspaceflight.activities.mainactivity" />      </activity> 

and here code intent...

intent intent = new intent(lf.getactivity().getbasecontext(), missionactivity.class); intent.putextra("launch", launches.get(getadapterposition())); lf.getactivity().startactivity(intent); 

hello #michael first of use android:parentactivityname=".activities.businesslisting" instead of using <meta-data .../> follows.

<activity         android:name=".activities.missionactivity"         android:label="mission"         android:parentactivityname="com.nextspaceflight.android.nextspaceflight.activities.mainactivity"         android:screenorientation="portrait"         android:theme="@style/apptheme.noactionbar"> 

second thing need notify adapter or list in onrestart() method follows.

@override     protected void onrestart() {         super.onrestart();         youradapter.notifydatasetchanged();      } 

thank hope work you.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -