My application's main activity is the preferences page. This is what gets displayed when the user clicks the application icon. I also have a service which sends the user status bar notifications, and can display a translucent overlay on the screen. I followed this post to create my transparent activity, and all of this works.
The problem is that ever time I display my translucent activity, the application's main window (the preferences page) is visible behind it. Meaning, that the translucent overlay appears on top of whatever other application is currently running.
How can I make so that when the translucent activity appears, no other activity from my application is visible?
This is my main activity's definition in AndroidManifest.xml:
<activity android:name=".AppPreferences" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I also have translucent overlay which uses a custom theme which derives from Theme.Translucent:
<activity android:name=".AppPopupActivity" android:theme="@style/Theme.SemiTransparent">
<intent-filter>
<action android:name="com.app.HIDE_POPUP"></action>
</intent-filter>
</activity>
Here is the layout for the translucent overlay:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button android:text="@string/button_done"
android:id="@+id/doneButton"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
</RelativeLayout>
</RelativeLayout>
And the service:
<service android:name="AppService">
<intent-filter>
<action android:name="com.app.AppService" />
</intent-filter>
</service>
To display the transparent activity I run the following in the service:
Intent intent = new Intent(this, AppPopupActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
Thanks you for your help