0

I have minimized my app using this..

                Intent startMain = new Intent(Intent.ACTION_MAIN);
                startMain.addCategory(Intent.CATEGORY_HOME);
                startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(startMain);

The app is waiting for some event while it is in minimized state.How can i return to the app activity when some broadcast event occurs?

i can access the minimized activity from the the broadcast receiver class(using an object passed to it earlier) but it is running in the background of home screen.

and does android kill minimized apps eventually?

Amel
  • 13
  • 1
  • 4

3 Answers3

2
Intent homeIntent = new Intent(this, HomeActivity.class);
homeIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(homeIntent);

this will start the HomeActivity, if the activity still in memory, it will just bring it to front.

Mohammad Ersan
  • 12,304
  • 8
  • 54
  • 77
1

You can start the activity again using the Intent.

Example :

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.package.address","com.package.address.MainActivity"));
startActivity(intent);
Eldhose M Babu
  • 14,382
  • 8
  • 39
  • 44
  • i wish i could.there is no option for me to choose it as right answer now(guess due to low reputation). i will mark it as soon as i can. – Amel Aug 30 '12 at 12:20
1

If you want to maximize the application you need user interface in that case you can add your application in notification bar, once user click on notification bar you can open in your word can maximize the same. Adding your application in to notification bar you can get many tutorials :

Notification

Daud Arfin
  • 2,499
  • 1
  • 18
  • 37