在Android中调用其他活动时如何避免黑屏? [英] How to avoid black screen while invoking another activity in android?

查看:89
本文介绍了在Android中调用其他活动时如何避免黑屏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用主要活动中的意图来调用活动.但是在调用过程中,很少显示系统对话框,因此会显示黑屏.我如何避免出现黑屏.

解决方案

请检查您在意图中设置的标志.

如果您有finish();或FLAG_ACTIVITY_CLEAR_TASK-ICS之前的设备上可能会出现黑屏,因为在开始另一个活动之前已清除了当前活动.

Intent intent = new Intent(getApplicationContext(), Activity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
overridePendingTransition (0, 0);

i am invoking an activity using intent from main activity. But during the invocation few system dialog boxes are displayed because of which a black screen is displayed. How can i avoid such black screen.

解决方案

Please check the flags you are setting in your intent.

If you have a finish(); or FLAG_ACTIVITY_CLEAR_TASK - a blank screen may show up on pre ICS devices as the current activity has been cleared before another activity is started.

Intent intent = new Intent(getApplicationContext(), Activity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
overridePendingTransition (0, 0);

这篇关于在Android中调用其他活动时如何避免黑屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆