本人小白一枚,今天在写项目的时候突然遇到一个问题:如何在界面中无操作十秒后自动跳转待机界面,待机点击被点击之后回到原来界面?查资料之后解决了,记录一下,废话不多说,上代码。
A界面实现代码:
先写一个handle:
private Handler THandle = new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
mIntent = new Intent(A.this,B.class);
startActivity(mIntent);
}
};
在onCreate()方法中发送handle消息:
THandle.sendEmpty