在eclipse中加载另一个活动 [英] Loading another activity in eclipse
本文介绍了在eclipse中加载另一个活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是java的新手,如果有人可以帮助我,我真的很感激。我的问题是如何或何时可以在计时器失效后插入代码来调用或启动另一个活动。
I am new with java and if somebody can help me with this i really appreciate. My question is how or when can i insert a code to call or launch another activity after the timer lapsed.
protected static final Thread This = null;
@Override
protected void onCreate(Bundle hard) {
// TODO Auto-generated method stub
super.onCreate(hard);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
Thread timer = new Thread(){
public void run(){
try{
Thread.sleep(5000);
}catch(InterruptedException e){
e.printStackTrace();
}finally{
Intent openStartingPoint = new Intent("--.---.---.------.MainActivity");
startActivity(openStartingPoint);
}
}
};
timer.start();
}
推荐答案
好像你正在制作闪屏,
使用处理程序这个和计时器不用于这个puropse,如果仍然想使用计时器,
确保你使用的东西,使计时,thred永远不能使用时间,
另一种选择是AlarmManager,你可以在10秒后做到这一点,你可以通过另一个活动...
查看此链接
[ ^ ]
http://androidideasblog.blogspot.in/2011/07/alarmmanager-and-notificationmanager.html [ ^ ]
你还可以谷歌更多...
最后你可以在asynch中使用这个线程并在postExecuteMethod中传递intent ...
it seems you are making splash screen ,
use handler for this and timer is not use for this puropse , if still want to use timer then ,
make sure you use something which makes timing , thred can never use for time ,
Another option is AlarmManager in which you can do like after 10 sec , you can pass another activiy...
check this links
[^]
http://androidideasblog.blogspot.in/2011/07/alarmmanager-and-notificationmanager.html[^]
you can also googling more ...
and lastly you can use this thread in asynch and pass intent in postExecuteMethod...
这篇关于在eclipse中加载另一个活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文