我正在使用我的一项 Activity 中的以下代码来开始另一项 Activity
Intent viewIntent = new Intent(getApplicationContext (), landingPage.class);
Bundle b = new Bundle();
b.putString("ApplicationName", a_Bean.getApplicationName());
if (landingPage.getInstanceCount() < 1)
bp.landingPage_ProgressDialog = ProgressDialog.show(ViewAllApp.this, "Please wait...", "Retrieving data...", true, false);
viewIntent.putExtras(b);
viewIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivityForResult(viewIntent,10);
Thread background = new Thread(new Runnable() {
public void run() {
Progresshandler.sendMessage(handler.obtainMessage());//finishes progressDialog
}});
background.start();
但在 startactivity 之后它显示黑屏,然后显示新 Activity 。 我可以让进度对话框在显示黑屏时显示吗??
最佳答案
这对我有用:
Intent intent = new Intent(LocationGrid.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
overridePendingTransition(0, 0);
关于android - 在 Activity 之间切换黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3699013/