In my Android app, I need to use Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK to set my goal flag. I can delete all previous Activities and start a new Activity in this way. This is my code below:
Intent intent = new Intent(Gerenxinxi.this, MainPart.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); finish(); overridePendingTransition(0,0);
However, when I used the code above, I detected a flickering black screen. If I did not set the intent flag with Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK , the flicker of the black screen will disappear. My question is: what can I do to avoid a black screen when Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK set Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK ?
Before writing this question down, I found that someone has a similar question. This is a link. However, the answers to this question cannot solve my problem. So I ask the question again. I hope someone can help me. Thanks.
source share