title: Do not show splash screen on return from settings activity
body: <p>I have an app that loads a <code>SplashScreen</code> as a full screen <code>Dialog</code> that closes on loading the <code>MainActivity</code>. However, the problem here is that whenever I open my <code>SettingsActivity</code> and come back to the <code>MainActivity</code> in the following ways:</p>
  
  <ol>
  <li>on Android back button press, the <code>SplashScreen</code> wont be displayed. So no problems here!</li>
  <li>on up navigation on <code>ActionBar</code> is pressed, the <code>SplashScreen</code> is displayed again. This is the problem, I don't want the <code>SplashScreen</code> displayed again.</li>
  </ol>
  
  <p>Here's my <code>MainActivity.java</code></p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      setPreferencesFromSettings();
      if (splashScreenDisplayed) {showSplash(); splashScreenDisplayed = false; }
      //...DO SOMETHING ELSE...//
  }
  
  public void showSplash() {
      final Dialog dialog = new Dialog(MainActivity.this, android.R.style.Theme_Light_NoTitleBar);
      dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
      dialog.setContentView(R.layout.activity_splash_screen);
      dialog.setCancelable(true);
      dialog.show();
  
      final Handler handler  = new Handler();
      final Runnable runnable = new Runnable() {
          @Override
          public void run() {
                  dialog.dismiss();
          }
      }; handler.postDelayed(runnable, 3500);
  }
  
  @Override
  public void onRestart() {
      super.onRestart();
      splashScreenDisplayed = false;
      setPreferencesFromSettings();
  }
  </code></pre>
  
  <p>And the <code>AndroidManifest.xml</code>:</p>
  
  <pre><code>&lt;application
      android:name=".AnalyticsApplication"
      android:fullBackupContent="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
      &lt;activity
          android:name=".MainActivity"
          android:label="@string/app_name"
          android:theme="@style/AppTheme"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity
          android:name=".SettingsActivity"
          android:label="Settings"
          android:parentActivityName=".MainActivity"
          android:theme="@style/AppTheme"&gt;
          &lt;meta-data
              android:name="android.support.PARENT_ACTIVITY"
              android:value=".MainActivity" /&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>I tried a few other posts however they didn't work for me. I know that I am missing a line of code or something somewhere, I spent hours looking at the code again and again and I couldn't find anything.</p>
  
  <p>Thanks in advance for your help!</p>