I try to open a new activity from another one after some seconds, I used this code, but it's not working (first activity runs but after some seconds I have an error)
public class WelcomeActivity extends AppCompatActivity {
private static int TIME_OUT = 4000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
startActivity(intent);
//finish();
}
}, TIME_OUT);
}
}
This is a stacktrace:
java.lang.RuntimeException: Unable to start activity ComponentInfo{________}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead