Android Activity without UI

Is it possible to create a Android activity without UI?

Yes it is. Android provides a theme for this requirement. Add the following line to your AndroidManifest.xml and call finish() at the end of the Activity’s onCreate() method.


android:theme="@android:style/Theme.NoDisplay"

Theme_NoDisplay

public static final class android.R.style – Added in API level 3
int Theme_NoDisplay
Default theme for activities that don’t actually display a UI; that is, they finish themselves before being resumed.

Constant Value: 16973909 (0x01030055)