我正在尝试编写一个简单的代码,以便在解锁设备时切换活动(如果应用程序已打开),因为我必须切换另一个活动,我已尝试过此代码。但即使是代码,它也会显示当前屏幕的分数第二个我该怎么办。
@Override
protected void onResume() {
// This is the second main Layout after main layout (which has
// background image)
mainLayout.setVisibility(View.INVISIBLE);
super.onResume();
checkActivity();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
SimpleChatMainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
//Visible after 1 second
mainLayout.setVisibility(View.VISIBLE);
}
});
}
}, 1000);
// Some code
}