Thursday, July 1, 2010

[android-developers] How to create Multiple instances of an Activity From a Service?

I was wondering is it possible to create multiple instances of a
single Activity in Android?

I currently start my own inCall screen for a Voip Test by using the
following code: (Used in a Service)

---

public void initInCallScreen(String pName, String phoneNumber,
int contactID, boolean
callDirection, int lineID){

//starts in callScreen dialog
final Intent myIntent = new Intent(context,
CallDialogActivity.class);
myIntent.putExtra("NAME", pName);
myIntent.putExtra("NUMBER", phoneNumber);
myIntent.putExtra("ID", contactID);
myIntent.putExtra("CALLTYPE", callDirection); //True =
Incoming, False = Outgoing
myIntent.putExtra("LINEID", lineID);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);

---

This allows me to start the Activity fine.

However when I call it for a second it just returns to the Activity
already created rather than creating a new Activity and placing it on
the stack.

I would like to be able to create the activity multiple times so that
I have two or 3 Activities on the stack and the user can switch
between them, using Home, Back buttons etc...

Is this possible and if so what am I doing wrong?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate