"invisible" application to switch without showing any window
I am writing a simple APN toggle application. I wanted to ask how to get Android to not show any windows. Currently, after launching my application, a black screen with the application name is briefly shown and then disappears. Is it possible to show nothing at all (Toast message only)?
public class ApnSwtichActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (toggleAPN()){
Toast.makeText(this, "Apn switched", Toast.LENGTH_SHORT).show();
}
this.finish();
}}
source to share
It sounds like you want to engage without an interface How to start an activity without a UI?
You probably want to use
android:theme="@android:style/Theme.NoDisplay"
source to share
I don't think this is possible exactly the way you want it. You can hide the title bar like this, add android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
to your manifest:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".TestActivity"
android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
>
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
source to share
You can create an action, make it transparent and give it the options FLAG_NOT_TOUCH_MODAL and FLAG_NOT_TOUCHABLE
(FLAG_NOT_TOUCH_MODAL passes any touch input that you pass your activity to the base screen, FLAG_NOT_TOUCHABLE overrides any input input commands for the activity)
Remember to activate your activity after you are done
source to share