我在 BrodcastReceiver 中的 A 活动和 i B 活动中。
@Override
public void onReceive(final Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
//start activity
((Activity) context).runOnUiThread(new Runnable(){
public void run(){
Intent i = new Intent(context, Pause.class);
i.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(i);
}
});
wasScreenOn = false;
} else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
wasScreenOn = true;
}
}
问题是,当解锁屏幕时,活动 A 在显示活动 B 之前出现一秒钟。我该如何解决?