I have the following problem: I have a splash screen that will be called only if it is the first application execution. If it is not the first run I would like to call another Activity .
I tried the following ... make a InitialActivity
as below:
public class InitialActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_initial);
final SharedPreferences sharedPref = getPreferences(MODE_PRIVATE);
boolean isFirstUse = sharedPref.getBoolean("is_first_use", true);
if (isFirstUse)
{
SharedPreferences.Editor editor = sharedPref.edit();
editor.putBoolean("is_first_use", false);
editor.commit();
startActivity(new Intent(this, SplashScreen.class));
} else {
//verify mode and call correct activity
startActivity(new Intent(this, MainActivity.class));
}
}
}
The problem is that this guy calls super.onCreate
and ends up creating this Activity . It turns out that it shows a white screen before deciding which initial Activity I want to go to.
How can I solve this problem?