【发布时间】:2012-09-26 09:44:36
【问题描述】:
我试图等到 spalsh 屏幕结束,然后当从 splash 获得结果时转到另一个活动但我的代码不等待启动 (AsyncTask) 只是为了之后的意图。 希望你能帮忙。
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);
【问题讨论】:
标签: android android-asynctask splash-screen