I have an Activity that runs at start up that handles global configuration and determines the correct Activity to launch based on the current application state. Since the Activity does not require any UI I am using Theme.NoDisplay, doing my work in onStart, starting the next activity and calling finish().
<activity android:name=".StartUpActivity" android:theme="@android:style/Theme.NoDisplay>
protected void onStart() {
super.onStart();
doConfiguration();
startServices();
startNextActivity();
finish();
}
This was working fine until I needed to add an asynchronous service call. Since the service call returned after onResume() I started getting this error:
An activity without a UI must call finish() before onResume() completes