android - 在 Activity 之间切换黑屏

标签 android progressdialog

我正在使用我的一项 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/

相关文章:

android - 更改 ProgressDialog 的样式

android - 没有 SD 卡时,ProgressDialog 不显示在 Galaxy S3 上

android - 在 Android 中异步发送 HTTP GET 请求的最佳方式?

android - ViewCompat.getLayoutDirection 在 onResume() 之前不会返回正确的布局

android - 如何从后台关闭进度对话框

android - 仅在有限/固定时间内隐藏进度对话框

android - 如何在 Android Studio 中扩展多个类?

Android缺少平台工具

android - Ionic - 电容器 - Android 风格 - 无法在模拟器或真实设备中运行应用程序

android - 在视频之前显示进度对话框