这里是源代码。这是一个基本的启动画面,如果按下按钮back
或menu
,我想完成此活动。Android:如果按下返回或菜单按钮,则在启动画面期间退出应用程序?
try {
super.run();
/**
* use while to get the splash time. Use sleep() to increase
* the wait variable for every 100L.
*/
while (wait < welcomeScreenDisplay) {
sleep(100);
wait += 100;
}
} catch (Exception e) {
System.out.println("EXc=" + e);
} finally {
/**
* Called after splash times up. Do some action after splash
* times up. Here we moved to another main activity class
*/
startActivity(new Intent(SplashScreenActivity.this,
StartActivity.class));
finish();
}
感谢您的快速回答,但我应该在哪里放置? – user1570984 2012-08-02 10:11:15
你可以把它放在活动内的任何地方我的朋友 – 2012-08-02 10:12:17
非常感谢 – user1570984 2012-08-02 11:51:48