views:

144

answers:

1

Hi, I'm having difficulties handling multiple instances of my root (main) activity for my application. My app in question has an intent filter in place to launch my application when opening an email attatchment from the "Email" app.

My problem is if I launch my application first through the the android applications screen and then launch my application via opening the Email attachment it creates two instances of my root activity.

steps:

  1. Launch root activity A, press home
  2. Open email attachment, intent filter triggers launches root activity A

Is it possible when opening the Email attachment that when the OS tries to launch my application it detects there is already an instance of it running and use that or remove/clear that instance?

+1  A: 

When sending your own intent you can specify how to launch the receiving activity by providing intent flags (See the Intent.FLAG* fields). When you are being called from a totally different activity you could set the android:launchMode on your activity in the manifest.

Soulreaper