Android :: Starting Two Instances Of Activity With Flag Intent

Jul 18, 2010

When starting two activities of the same class within the same instance using the flag REORDER_TO_FRONT, the new extra information of the second call does not override the first starting activity. Is this the desired behavior? How do retrieve the new extras?

For example: In the StubActivity, I have this code:
Intent i = new Intent(this, A.class);
i.putExtra("foobar",1); startActivity(i);

Activity A is displayed, and then this code is called upon a button press:
new Intent(this, A.class);
i.putExtra("foobar",2);
i.setFlag(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(i);

Activity A is re-displayed. Now check for the extras: int foobar = getIntent().getExtras().getInt("foobar")
Turns out that foobar = 1

Android :: Starting Two Instances of Activity with Flag Intent


Android :: Starting Activity With FLAG ACTIVITY MULTIPLE TASK To See Multiple Instances

Feb 2, 2009

I am trying to launch an activity from another activity .. Within the com.android.SingleLauncher..

I have activity launch code as ..

CODE:...........

I have set the android:multiprocess="true" in the AndroidManifest.xml of TargetSL I don't seem to see the multiple instances of TargetSL, which i am expecting ..

All i see is 2 process, where i was hoping to see an instance of TargetSL, for each launch that was invoked by the singleLauncher!

View 3 Replies View Related

Android :: Intent Filters - Prevent Creation Of Multiple Activity Instances?

Feb 16, 2010

I added an intent filter to one of my activities, so that when a user clicks a URL like "www.mysite.com", and if my app is installed, my registered activity can be launched. It works well.

I see that this creates a new instance of my registered activity though, every time a link is clicked. Is there any way to prevent multiple instances from being created - just recycle an existing instance if one already exists?

View 6 Replies View Related

Android : Multiple Activity Instances Launched By Same Intent. Bring One Uniquely To Foreground?

Nov 12, 2010

I'm struggling with my app that launches multiple instances of the same Activity using the same intent. My main activity is of class type A and it does a startActivity() of two children that are of the same class type B. So we have B1 and B2 launched. If B1 and B2 are both paused (by pushing back button and making sure finish() is not invoked on them so they are truly paused), how can A uniquely bring either B1 or B2 to the foreground again? I do want to launch a new B activity. I want to uniquely bring B1 or B2 to the foreground.

so both B1 and B2 were created like this... Intent intent = new Intent(context, B.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);

Now I want A to bring B1 (or B2) to the foreground/front so I use the below code, but how do I distinguish B1 or B2 when starting the activity? This only brings the last instance of B that was on top to the foreground.

Intent intent = new Intent(context, B.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent);

I've tried keeping around references to B1 and B2 and doing something like this, but this also only goes to the last instance of activity class B that was on top...

Intent intent = new Intent(B1context, B.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); B1context.startActivity(intent);

I even tried this, but it still doesnt get me my unique B1 or B2... Intent intent = B1.getIntent(); // i.e. the original intent that started me startActivity(intent); // still only brings to front the last B that was on top.

View 3 Replies View Related

Android :: What Is The Significance Of Context In Various Constructor Of Intent Class When Starting An Activity

Mar 4, 2010

I had come across a code snippet which calls for an activity without referring to any context. Before, i was considering that context is used to tell about the calling component. But as i came see that another component can be called without any reference to context, it makes me wonder what purpose it might be serving. please put some light on it.

Here is the code which calls for an activity without referring to 'context'

CODE:............................

View 1 Replies View Related

Android :: Mulitple Instances Of Pending Intent

Sep 16, 2010

I created a widget that when clicked activates a PendingIntent.The problem is when I have more than one widget on the screen only the latest one will start the PendingIntent.I have read some about a unique request code, but not figured this out.Any ideas how I can have multiple widgets and the PendingIntents work for each?

View 1 Replies View Related

Android :: Activity Restoration With Flag New Task

Nov 15, 2010

Question related to Android Activity Restoration:

In my application there is a background Service from where I am launching Activities, Activity A and B. I am launching Activity A on some external events using "FLAG_ACTIVITY_NEW_TASK" (I need to use this flag to launch Activity A from Service, if did not then my application segments, Don't know why this happens) and Activity B without this flag. Activity Launching Sequence is as follows:
Service --> Activity B --> Activity A (With FLAG_ACTIVITY_NEW_TASK)
When we are in Activity A and we Hit Home key It returns to "Android Home" Screen and then after Selecting Application Icon, android does not launch Activity A again It displays Activity B. When we hit back key on Activity B it gets deleted (as it should) and then after Selecting Application Icon again It displays Activity A.

Why this might be happening? Have I explained it properly?

View 1 Replies View Related

Android :: Calling StartActivity From Outside Of An Activity Context Requires The Flag_activity_new_task Flag

Sep 21, 2010

I tried to create a edittextbox, and button next to it, in the status bar.! I created it and tried to launch the browser activity, when somebody enters a URL in the textbox & click that button.

I get runtime exception as below.Can anyone please help what is the issue with this exception ? I know that Status bar is not a seperate activity. It is part of 'PhoneWindow'.

CODE:.............................

View 7 Replies View Related

Android :: How To Create Multiple Instances Of An Activity

Feb 19, 2010

I want to create multiple instances of an activity in the same process. Should I use FLAG_ACTIVITY_NEW_TASK flag like the code below?

CODE:...............

This code is executed in class A to create another instance of activity A.

This question, will this code create another task? As I understand is a process can only have one task. Does it mean the two activities will exist in different tasks? That's what I want. I want the two activities to be in the same process.

View 1 Replies View Related

Android : How To Create Multiple Instances Of An Activity?

Jul 1, 2010

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...

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?

View 1 Replies View Related

Android :: Differentiate Emulator Instances And Real Device Instances

Jul 22, 2009

I need to correctly be able to differentiate between emulator instances. I know it's easily done with real devices. With real devices, you can use getDeviceId or getLine1Number from TelephonyManager. With emulators, all the instances have the same device id, same subscriber id, and same line1 number. Is there a way to differentiate them? Using NetworkInfo, I can call the toString method and I get my ip and the port on the computer. The problem with that is that the port is always different. I would like something more stable. Like when you use "adb devices" in command line. Emulator #1 is almost always "emulator-5556" and emulator#2 is almost always "emulator-5554". Is there a way to get the same info I get from "adb devices" in my code? If not, is it possible to use a command line parameter to force the emulator to use a certain phone number?

View 3 Replies View Related

Android :: Unwanted Automated Creation Of New Instances Of Activity Class

May 11, 2010

I have an activity (called Sender) with the most basic UI, only a button that sends a message when clicked.This works ok, the message is sent but every time a message is sent a new instance of Sender is started on top of the other. If I call sendSMS method three times, three new instances are started. I'm quite new to android so I need some help with this, I only want the same Sender to be on all the time

View 3 Replies View Related

Android :: ClassNotFoundException When Starting Intent

Jun 11, 2009

I have a problem and cant realize a reason. I have ClassNotFoundException when starting Intent i = new Intent(EventInfo.this, AndricoMap.class); i.putExtra("address", address); startActivity(i);

There are log and class below

CODE:.....................

View 5 Replies View Related

Android :: Starting Video Camera With Intent

Sep 20, 2010

I am writing a very small app that just opens the camera app ready for video. I am able to get my code to work on an Android 2.2 emulator, but it will not work on my device, Motorola Droid 1 stock 2.2 FRG22D. Any ideas where I went wrong on this code?

CODE:............

It appears ThorstenW is correct. I would upvote your answer if I had enough rep. You can see from the logcat that com.android.camera could not be found and throws a fatal exception. Logcat below.

CODE:...................

View 2 Replies View Related

Android :: Starting Second Activity From Main Activity On Button Click

Dec 4, 2009

Need an example of how to create/start a new activity from the main activity. I have a button click event on the main layout. Originally I just used setContentView(R.layout.secondactivity); which brings up the layout but I don't think that is correct since the secondactivity class is not instantiated at this point yet. I have looked for such an example and can not find one.

View 3 Replies View Related

Android :: Starting Map Activity From Normal Activity

Apr 25, 2010

I have a map app which works fine when its stand alone but it causes an unexpected error when I try to add it as part of another app. My current app which extends Activity tries to launch the map activity with the following lines of code Intent m = new Intent(this, HomeSetter.class); startActivity(m); I also have the xml setup correctly <activity android:name=".HomeSetter" android:label="Screen 4"> </activity> <uses-library android:name="com.google.android.maps" /> </application> However when I try to launch it crashes everytime. I've tried searching the net but I've had no joy in finding a solution 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

View 4 Replies View Related

Android :: Starting Activity Behind Current Activity

Oct 2, 2009

startActivity() displays the new Activity on top of the current one. But how to display it underneath instead? BTW, I'm starting an Activity from another application, if that makes a difference.

View 5 Replies View Related

Android :: Starting New Activity From Activity

Jun 9, 2010

When I was originally learning about Android a few months ago I swear I read something about a way to immediately launch an activity when starting a task. I am curious about this now because I need to display an intro screen on launch but I don't want the intro screen to be the root activity. Does anyone know if there is something like this and if not what is the best way to handle an intro screen?I tried googling for a few hours to find it but can't for the life of me.

View 1 Replies View Related

Android :: Exclude Own Activity From Activity.startActivity - Intent

Oct 17, 2010

My app works with pictures. It can take multiple pictures as an input, process them, and send them again to another app.

As a consequence, my main Activity has declared an intent filter on ACTION_SEND_MULTIPLE for image/* mimetypes and can result in issuing a new Intent with the same action and data type using Activity.startActivity(Intent).

Is there a way to exclude my own activity from the list of apps that is displayed to the user after the startActivity() call ?

View 1 Replies View Related

Android :: Starting Activity With Tabs

May 7, 2010

I have four activity in a Tab and after the user clicked on the list I would like to start another one activity, but I can't use startActivity(Intent), because then I lost the TabHost view, and I get an activity witch is reserving the full screen:( So the user won't be able to click on the other tabs. What should I use? BroadCastReciver or What? If anyone have any good idea please help on me.

View 4 Replies View Related

Android :: Starting Activity By Package Name

Mar 25, 2010

I have the code to get the list of packages installed in phone. I have represented the list in the form of Array List, below is the code snippet. But upon clicking in the package name I want to start that application, but how do I get the respective class name and package name to run? Is there any other method which I can try to start an application? arrayList<String> PackageNames = null; List<PackageInfo> lis = pm.getInstalled Packages(GET_MINIMAL); Pkgs = (ListView) findViewById(R.id.package_list); for (Package Info pi : lis)packages.put(pi.packageName, pi); PackageNames = new ArrayList<String> packages.keySet()); Collections.sort(PackageNames); PackageNames.add(0, "All"); pgs.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple _list_ item_1, PackageNames)); Pkgs.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View v, int pos,long rowId) { Intent i = new Intent(); i.setComponent(new ComponentName(class name,packagename)); startActivity(i); I have tried intent to start the activity, but don't know the class name and package name to pass in the ComponentName() to start activity.

View 2 Replies View Related

Android :: Error When Starting Activity

Mar 22, 2010

I'm starting an activity when a button is pressed, and normally (in other apps) haven't had an issue. But when I press the button in this app, I get an "unable to marshal value" error.Exact(ish) error from LogCat:
03-22 02:49:02.883:
WARN/System.err(252):
java.lang.RuntimeException: Parcel:
unable to marshal value
{CLASSNAME}@44dcf1b8
I feel that this might be related to the extra that I'm passing to the intent. I'm passing an ArrayList as a serializable to this new intent. My concern is that the data structure that the ArrayList contains isn't being serialized (as it's a personal data structure).Is the array list content data structure causing this? Something else that I'm missing?

View 1 Replies View Related

Android :: Starting An Activity For Different Third Party App

Aug 19, 2010

I'm working on an app and I want to integrate the Last.fm app into it. Basically, when someone is looking at an artist in my app, I would like to have a button that they can tap to open up Last.fm application with the artist's information.

This intent works, but it loads a menu asking which app I would like to use (Browser or Last.fm):

CODE:..........

However, I just want to start the Last.fm app and skip the dialog asking which app to use, I thought maybe using the setPackage() method would work like this: i.setPackage("fm.last.android");


But it causes the app to crash:

CODE:............

Is it possible to just start the Last.fm app?

Here's a copy of Last.fm's AndroidManifest.xml for reference.

View 1 Replies View Related

Android :: Error When Starting A Tab Activity?

May 16, 2010

I followed the directions verbatim in this Android tutorial, copying/pasting the code from the site to my app. http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

However, when I try to run in the Android emulator, I get the error: "The application Hello Tab Widget has stopped unexpectedly. Please try again."

I tried debugging by introducing a breakpoint in the first line of the onCreate method, but the error occurs before the breakpoint is even hit. Any idea of what is going wrong, or any other way I can debug this issue? I am using Eclipse.

View 2 Replies View Related

Android :: Tabs - Starting A New Activity

Dec 31, 2009

I have 4 Tabs in a TabHost...let them be A,B,C,D.... now each one is just an index page and clicking on any of them shows a different activity...

The problem is that i need to start another activity wen user selects something from the content displayed in the tab... The other activity should also be displayed in the parent tab itself... is it by any chance possible or i'll have to try some other way around?

View 2 Replies View Related

Android :: Starting An Activity In OnStart

Apr 14, 2010

I'm trying to start a floating activity from onStart to retrieve some info from the user right when the initial activity begins.

I have the following:

CODE:............

And callProfileDialog() is just:

CODE:..........

ProfileDialog.class returns a String from an input box. If the result returned is RESULT_CANCELED then I restart the activity.

The problem I'm having is that when the program starts, the screen is just black. If I hit the Back button a RESULT_CANCELED is returned then the initial activity shows as well as the floating activity (since it recalled itself when it got a RESULT_CANCELED). Why can't I get the activities show by calling ProfileDialog.class from onStart()? I got the same result when I called it at the end of onCreate() which is way I switch over to use onStart().

I have also tried the following:

CODE:.........

But this doesn't work either. It all works fine once I hit the back button but without doing that, it's all black.

View 3 Replies View Related

Android :: OnRecieve Starting Activity?

Jun 23, 2009

I would like to know the reason behind this behaviour.I have a broadcast reciever and in onrecieve i am trying to start an activity,however if i am not giving the flags it is giving an exception .On declaring the flags it is working perfectly fine,why?

I was under the impression that onRecieve runs in the main UI thread and we can launch an activity in onRecieve.Error given by the emulator is self explanatory but still why do i need to create an activity in a new task(only in onRecieve)?

CODE:....................

View 4 Replies View Related

Android :: Name Of Droid App Taken As Of Starting Activity / Why Is This?

Oct 18, 2010

In my manifest file, I have given the application name as MyApp and the name of the starting activity as Main Menu.code...

When I see the app icon in the default menu screen of android, the name shown is Main Menu. Why is MyApp not the name shown for the app?

View 2 Replies View Related

Android :: Progress Dialog While Starting New Activity

Feb 9, 2010

this button is shown on my start activity. After pressing it a new activity will be launched but this takes some time cause on initialization of that new activity some data is gathered from the Internet. This works half. The progress dialoge is shown but the progress wheel is not spinning.

Can somebody tell me why this happens?
Button b4 = (Button) findViewById(R.id.Button01);
b4.setOnClickListener(new View.OnClickListener() {
public void onClick (View view) {
final ProgressDialog pd = ProgressDialog.show(pak.this,
"", "Working..", true);......................

View 1 Replies View Related

Android :: Previous App Launches Not Starting Activity

Jun 2, 2010

I need a way to detect if this is the first time the user is ever opening the application, if so, start an activity. Then all previous application launches wouldn't start that activity. I've read in a few places about using preferences to accomplish this. Anyone got any ideas?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved