How to transfer work on Android to android?

I use the moveTasktoBack () function to send my activity to the background. I want to transfer my activities to the front when the timer in my activity ends. I use the phone key back to send activity back. How can I do it? Help me please.

+4
source share
3 answers

Exact The same question that is mentioned in this Question.

Considered it the following code fragment. i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) ; actauul, which brings activity back to the fore.

 Intent i=new Intent(ApplicationStatus.this,NotifyActivity.class); //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); i.putExtra("ID_TimeLeft",String.valueOf(TimeLeft)); startActivity(i); 
+4
source

I think it should be FLAG_ACTIVITY_SINGLE_TOP .

+2
source

You can use intent with the appropriate flags. FLAG_ACTIVITY_NEW_TASK to create a new task to keep your activity if it does not already exist. FLAG_ACTIVITY_REORDER_TO_FRONT so that your activity is ahead of the task, if it does not already exist.

 Intent intent = new Intent(context, YourActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); 
0
source

All Articles