我试图等到spalsh屏幕结束,然后当从splash获得结果时转到另一个活动但我的代码不等待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);