Sometimes, when navigating creating complex activities or navigations, you absolutely do not want there to be more than one instance of an activity.

For example, in our Simply Advanced LTE Discovery app, creating a new activity via a notification caused threading issues. We tried many different ways of going about the problem and eventually found the correct solution, just in time before our hard deadline.

The easiest and best way to ensure you don’t create extra instances of an Android activity to add the following line to the AndroidManifest.xml inside the tags.


“singleTop” is just one of four different attribute you can give your activities. The other ones are “standard”, “singleTop”, and “singleInstance”. You can find much more great information on the official Android developer guide.

More of the code:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="" package="net.simplyadvanced.ltediscovery" android:versionCode="3" android:versionName="2.0" >

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application android:label="@string/app_name" android:theme="@style/AppTheme" >
            android:launchMode="singleTop" >
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />