Android 等待完成时无法看到启动屏幕
我正在尝试等待,直到spalsh屏幕将结束abd,然后当从splash获得结果时,转到另一个活动,但我的代码不等待splash(AsyncTask),只是在意图之后进行。 希望你能帮忙Android 等待完成时无法看到启动屏幕,android,android-asynctask,splash-screen,Android,Android Asynctask,Splash Screen,我正在尝试等待,直到spalsh屏幕将结束abd,然后当从splash获得结果时,转到另一个活动,但我的代码不等待splash(AsyncTask),只是在意图之后进行。 希望你能帮忙 lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position,
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
String nextActivity=new String();
Thread splashTread = new Thread() {
@Override
public void run() {
try {
splash splash=(tools.splash) new splash(first.this).execute();
int waited = 0;
while(splash.running && (waited< getResources().getInteger(R.integer.splashTimeOut)))
{
sleep(100);
if(splash.running) {
waited += 100;
}
// nextActivity=splash.newActivity;
}
Intent intent = new Intent(first.this,Class.forName("activities.third"));
startActivity(intent);
} catch(InterruptedException e) {
// do nothing
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
finish();
}
}
};
splashTread.start();
try {
Intent intent = new Intent(first.this,Class.forName("activities.third"));
startActivity(intent);
lv.setOnItemClickListener(新的OnItemClickListener(){
public void onItemClick(AdapterView父级、视图、,
内部位置,长id){
字符串nextActivity=新字符串();
螺纹飞溅踏板=新螺纹(){
@凌驾
公开募捐{
试一试{
splash splash=(tools.splash)新的splash(first.this.execute();
int=0;
while(splash.running&(waited
使用此代码
Intent intent = new Intent(first.this,Class.forName("activities.third"));
startActivity(intent);
在
finally
beforefinish()
而不是start try block;我得到一个错误09-26 08:44:14.738:E/AndroidRuntime(332):java.lang.RuntimeException:无法在未调用Looper.prepare()的线程内创建处理程序,我认为这是因为AsyncTask有一个guithen use UIthread。请参阅此