I'm unable to make my app to run only one instance. When I press on the app to start it then press the home button and press on the app start another instance the previous instance is not being killed before starting a new one. When the app is loaded I press back button to close it and then another instance pops up right after closing the first one...
AndroidManifest.xml
<activity android:name=".StartUpActivity" android:configChanges="orientation|screenSize" android:label="@string/app_name" android:noHistory="true" android:launchMode="singleTask"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> StartUpActivity
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_loading); new Thread(new Runnable() { @Override public void run() { Intent activityIntent; // DO STUFF activityIntent = new Intent(context, RegNewUser.class); startActivity(activityIntent); } }).start(); }