Starting one activity brings all the other activities in the same process to front?

by krox » Wed, 21 Apr 2010 08:44:31 GMT


Sponsored Links
 Hi!

I have an application consisting of two activities (call them Display
and Preferences) and one service which listens for incoming
phonecalls. When it detects one it launches the Display-activity with
a delay of 3sec in order to let the PhoneApp launch first. The Display-
activity is transparent so the user can still use the PhoneApp as
normal (ie answering the call) even though my Display-activity is "on
top". So far so good :-)

Now to my problem. Lets say that the Preferences-activity is active
when there is an incoming call. The PhoneApp is launched on top of the
Preferences-activity as expected. However when the Display-activity is
launched the Preferences-activity pops up as well, hiding the
PhoneApp. My question is if it is possible to work around this in some
way? Since I do not want my Preferences-activity to block the PhoneApp
and hence making it impossible for the user to answer the incoming
phone call.

Kind regards,
Erik

--



Starting one activity brings all the other activities in the same process to front?

by Dianne Hackborn » Wed, 21 Apr 2010 09:24:41 GMT


 This is due to "task affinities."  By default all activities in an .apk have
the same task affinity, so that when one is launched it is associated with
any current task started via any other activities in the app.

If you publish multiple top-level activities in your app, you will probably
want to give them different task affinities so the system does not try to
treat them as part of the same logical flow.  This is accomplished with the
android:taskAffinity attribute in the manifest, as described here:

 http://developer.android.com/guide/topics/fundamentals.html #afftask

< http://developer.android.com/guide/topics/fundamentals.html #afftask>And
here:

 http://developer.android.com/guide/topics/manifest/activity-element.html #aff

Another place where it is useful to set the taskAffinity is for an activity
that is launched from a notification, so that it will be launched separately
from the main application and thus allow the user to press back to return to
whatever they were doing instead of having to go back through whatever is on
your main task's stack.  In this case you would set android:taskAffinity="",
saying that activity has no affinity to other activities.




>


Sponsored Links


Starting one activity brings all the other activities in the same process to front?

by krox » Wed, 21 Apr 2010 10:29:30 GMT


 Thanks!




> >



Other Threads

1. HTC Incredible no default external storage?

the HTC incredible is now available for pre order at Verizon. Engadget
has already done a review at:

http://www.engadget.com/2010/04/19/droid-incredible-review/

They mention that there is a storage issue with a lot of apps because
it does not come with an external SD card by default. It does have a
lot of separate internal storage, but apps cannot use it.

Does anyone have more info about this from a developer's point of
view. What path will Environment.getExternalStorageDirectory() return
and what is the correct way to get the path of the internal storage?

-- 

2. Multitouch / Pinch To Zoom in Android 2.2?

Hi.

In Android 2.1 update 1 multitouch was silently added. Unfortunately
it is only available when also the zoom picker is **active**?! I am
sure there are cases where that setting makes sense, but it was not
possible to separately turn on one or the other.
I thought they didn't want to change the API with with an "update-1"
and would now surface the API in Android 2.2.
At least my initial check didn't turn up anything in that respect though ;-(.

Also I don't know if multi-touch pinch/zoom still works in Android
2.2, because I don't know how to test it on the emulator. Does anybody
know or has other insights to share?

On a sidebar. Do I see this right? The developers get the new Android
version before their users? Loving it! Thanks.

Cheers,
Mariano

Btw. OT, but the first 45 minutes of the keynote totally rocked. Much
better than the latest three Steve Notes combined.

-- 

3. Touch Screens

4. Info: Android Predicates (Surrounding Architecture)

5. Android Suspend geeting called continuously

6. Application losing SharedPreferences and Sqlite database on Droid

7. Miring di hari Sabtu