vendredi 8 mai 2015

Unable to hide Action Bar before starting another activity

I'm trying to first create an activity, then after 2 seconds, I want to hide the action bar and then after another 2 secs, I want to start another activity but this code - getActionBar().hide() isn't working. Here is my code -

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_start);

    //final ActionBar actionbar = getActionBar();

    Thread timer1 = new Thread() {
        public void run(){
            try{
                sleep(2000);
            } catch(InterruptedException e){
                e.printStackTrace();
            } finally{
                getActionBar().hide();
            }
        }
    };
    timer1.start();

    Thread timer2 = new Thread() {
        public void run(){
            try{
                sleep(2000);
            } catch(InterruptedException e){
                e.printStackTrace();
            } finally{
                Intent intent = new Intent("app.lost_and_found_0.STARTINGPOINT");
                startActivity(intent);
            }
        }
    };
    timer2.start();
}

Is there something wrong I'm doing wrong? My application theme is set to Theme.Holo.Light in manifest file.

Aucun commentaire:

Enregistrer un commentaire