问题描述:

please some help all projects i write with thread are telling me same thing

just anything with thread gives me problem

please i have a competition to win please quick answers

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.splashscreen);

//getActionBar().hide();

/*start up the splash screen and main menu in a time delayed thread*/

new Handler().postDelayed(new Thread() {

@Override

public void run() {

Intent mainMenu = new Intent(MainActivity.this,

SFMainMenu.class);

MainActivity.this.startActivity(mainMenu);

MainActivity.this.finish();

overridePendingTransition(R.layout.fadein,R.layout.fadeout);

}

}, SFEngine.GAME_THREAD_DELAY);

}

网友答案:

See the API reference public final boolean postDelayed (Runnable r, long delayMillis)

You should use Runnable. Try

new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            Intent mainMenu = new Intent(MainActivity.this,
                    SFMainMenu.class);
                    MainActivity.this.startActivity(mainMenu);
                    MainActivity.this.finish();
                    overridePendingTransition(R.layout.fadein,R.layout.fadeout);
        }
    }, SFEngine.GAME_THREAD_DELAY);
相关阅读:
Top