gpt4 book ai didi

android - 适用于 Android 的启动图像

转载 作者:太空狗 更新时间:2023-10-29 15:55:41 26 4
gpt4 key购买 nike

我在 Activity 开始时制作了一张启动图片以显示..图像显示完美。但问题是当我调用它时

public class SplashImageActivity extends Activity {
protected boolean active = true;
protected int splashTime = 5000; // time to display the splash screen in ms

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);

// thread for displaying the SplashScreen
Thread splashTread = new Thread() {
@Override
public void run() {
try {
int waited = 0;
while(active && (waited < splashTime)) {
sleep(100);
if(active) {
waited += 100;
}
}
} catch(InterruptedException e) {
// do nothing
} finally {
startActivity(new Intent(SplashImageActivity.this,Myapps.class));
finish();
//startActivity(new Intent("com.splash.com.MyApps"));
//startActivity( new Intent(getApplicationContext(), Myapps.class));
}
}
};
splashTread.start();
}

@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
active = false;
}
return true;
}
}

继续下一个 Activity stop() 不起作用。它不会参加此 Activity 。我在 list 中添加了所有 Activity 。 stop() 显示在这样的代码中

enter image description here

有什么问题吗?

最佳答案

启动activity后无需调用stop()和finish()

finally 
{

startActivity(new Intent(currentclass.this,nextActivity.class);
finish();
}

关于android - 适用于 Android 的启动图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11183828/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com