Android :: Update Intent Of An Existing Activity While Calling StartActivity

Sep 13, 2010

I am having two activities, say activity A and B. Activity A is an ListActivity, and when the items in the list is selected, it will call startActivity() to bring up B. The problem here is that when I am in B and click the home key, and then go to the application launcher to resume my application, A will be brought up again. This time when I click a different item in A, it will bring up B with the old data of the previously selected item before the home key was clicked.

After examinzing the code, I found that the startActivity does not update the intent of B. I found a post here about the similar question, and the answer was to overwrite the onNewIntent. However, I found that it doesn't work, because this method never get called when the second time I call startActivity. I am sure that this is the same instance, because I've printed out the instance number. Is there any other ways to update the intent of the activity? Or I need some other settings to make the onNewIntent get called? I didn't set any flags or launch modes, so everything is default.

Android :: update intent of an existing activity while calling startActivity


Android :: Calling StartActivity From Outside Of An Activity

Dec 7, 2009

I have a TabActivity subclass that attempts to start a new activity via a menu item selection in onOptionsItemSelected.I am receiving the following exception which eludes me at the moment.I'm not sure why it thinks I am *not* in an activity!

View 2 Replies View Related

Android :: Calling StartActivity From Outside Of An Activity - Getting Error

Sep 11, 2010

I'm using an AlarmManager to trigger an intent that broadcasts a signal. The following is my code:

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

I'm calling this code from an activity, so I don't know how I could be getting the following error...

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

Is this really what you want?

View 1 Replies View Related

Android :: Calling StartActivity From Outside Of An Activity Context

Oct 12, 2010

I have implemented a ListView in my Android application.

I bind to this ListView using a custom subclass of the ArrayAdapter class. Inside the overridden ArrayAdapter.getView(...) method, I assign an OnClickListener. In the onClick(View v) method of the OnClickListener, I want to launch a new activity.

I get the exception:

Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

How can I get the context that the ListView (the current Activity) is working under?

View 2 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 :: 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 :: StartActivity -intent - And Resume To Main Activity

Jul 2, 2010

I've got an app that creates an intent for the last.fm android app in which it will start the "recommended" station for my account when i press a button. The trick i'm trying to figure out is how do i get the phone back to my app without the user having to navigate back manually? Once it start the last.fm intent it takes you to the playlist and i need it to resume back to my app automatically.

View 2 Replies View Related

Android :: Pass Intent Via StartActivity() To A Running Activity

Aug 10, 2010

MyService and MyClient are both running, although MyClient is currently in the background. If MyService sends an Intent to MyClient via:

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

How do I get this Intent in MyClient? Running this code triggers onResume() in MyClient, but because it's already running, calling getIntent() returns the Intent that initially created MyClient, which is always android.intent.action.MAIN

View 2 Replies View Related

Android :: Handle Existing Instance Root Activity Launching Root Activity From Intent Filter

Apr 3, 2010

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: Launch root activity A, press home 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?

View 1 Replies View Related

Android : How To Use Variable While Calling New Activity In Intent?

Feb 2, 2010

Can any one guide me how to achieve this?

View 4 Replies View Related

Create New Activity Or Update View Of Existing Activity?

Dec 24, 2012

I am working on developing an app and I am not sure when should I use a new activity and when should I update the existing view.

For example, lets say I have a view that shows a multiple choice question.Now, when the user selects his choices and clicks on say "Evaluate", I want to show the same question view but along with the right answers and explanations for each option. So does that mean, I should send an Intent upon a click on Evaluate or I should just update the view (i am not sure how)?

If I send an intent and show a new screen, how can the user go back to the next question without displaying the answers? If I don't create an new activity, how can I update the existing view that is already displayed?

View 4 Replies View Related

Android : Purpose Of Using Intent.createChooser() In StartActivity()?

Sep 27, 2010

When ever we need to send an email in Android we will invoke registered email application using Intent.ACTION_SEND. like the below

Intent i = new Intent(Intent.ACTION_SEND);

startActivity(Intent.createChooser(i, "Send mail..."));

My doubt is why do we need to use Intent.createChooser in startActivity rather than using
startActivty(i).

Is there any specific reason of using Intent.createChooser()?

View 1 Replies View Related

Android : StartActivity Intent Fails When Certain Apps Are Running

Jan 27, 2010

I am running into a critical conflict of sorts. My app is a remote service which essentially starts an activity when the screen goes to sleep. How it does this is very simple via screen off broadcast receiver and then an explicit intent to start the activity as a new task. The activity is basically in charge of responding to key events and displaying some simple text.

Thanks to a few window flags added in 2.0, activities can do this. They can be created in a way that either puts them on top of the lockscreen, or completely dismiss the lockscreen. This way they basically have focus without the lockscreen having to be dismissed by user. The alarm clock in 2.0 uses the flags to wake up the device and show the alarm dialog. I use them to place my activity when the screen sleeps so the user sees a custom wakeup lockscreen. The reason we create it at screen off is to get rid of lag the user experiences at wakeup involving first seeing the lockscreen, then seeing the activity appear. Also doing it immediately at sleep allows it to have focus so it can handle key events effectively.

The process works perfectly except in certain apps. So far, it seems the bug is consistent while browser (and even dolphin browser) as well as the facebook app are running. The bug never happens in GTalk or Launcher. It is rare but can still be duplicated in the messaging app every so often. I can't figure out why my activity doesn't get created at sleep while these apps are active. My remote service still gets the screen off broadcast and does the startActivity for the explicit intent, and that's all I get in the log. My onCreate is not being called. Instead it gets called when we wake the screen up again.

I have tried, as a control, to hold the partial wakelock starting when my remote service gets created, and the issue persists. So I don't believe it is a problem that the CPU has gone to sleep. Since only these particular apps cause the issue to duplicate, I can't imagine why the activity start fails. What could those apps be doing to interfere with another app's ability to get created? I use singleInstance as the launch mode so that I can ensure that the activity will never be able to be recalled by user process. I want it to go away when user unlocks and it is working fine like this, as long as it is able to be created. The singleInstance ensures I can have the same lockscreen handle an intent to do something specific based on user actions that the remote service monitors.

my source code can be viewed on my project page. http://code.google.com/p/mylockforandroid/source/browse/#svn/trunk/myLock/src/i4nc4mp/myLock

The issue happens to both my CustomLockService and NoLockService variations. These two services will start Lockscreen or ShowWhenLockedActivity and the bug is witnessed. The build illustrating the bug's end result-- user has to try to unlock 3 times due to the bug because on wakeup when the oncreate finally succeeds, user is seeing the activity when normally it would have auto-dismissed thanks to key event logic that also isn't seeming to happen due to the delayed onCreate, so they have to send it to sleep again. Now that the activity is properly done being started, and screen is asleep, the expected functionality happens at next wakeup-- can be downloaded also from the downloads tab.

This seems like an extremely irrational thing to be caused only by specific apps. I am quite baffled and out of ideas for a solution unless I've made some critical mistake in my activity definitions.

View 1 Replies View Related

Android : How To Use An Intent To Update An Activity?

Aug 24, 2009

I have a service that is downloading a file. When the download is done, I would like to update my "Downloaded files" list in my Activity, but only if the Activity is running. I do not want the Activity to start if it's not already running. I was hoping I could do this by making a new Intent with some special flag. Anyone have any idea how I can achieve this? A tiny code example maybe?

View 3 Replies View Related

Android : Way To Use Intent To Update A Value In Another Activity?

Sep 1, 2010

I want to pass a value from one Activity to another to update an integer. So basically I want Activity2 to send Activity1 a value it has garnered from user input. Seems like it should be simple just not sure how. Is it possible to run a function from another Activity and give it this value as an argument?

View 1 Replies View Related

Android :: Start An Activity In Different Apk Using StartActivity - Using The Activity Name Or Similar

Apr 20, 2010

I have tried to write an Android application with an activity that should be launched from a different application. It is not a content provider, just an app with a gui that should not be listed among the installed applications. I have tried the code examples here and it seems to be quite easy to launch existing providers and so on, but I fail to figure out how to just write a "hidden" app and launch it from a different one.

The basic use case is:

App A is a normal apk launchable from the application list.

App B is a different apk with known package and activity names, but is is not visible or launchable from the application list.

App A launches app B using the package and class names (or perhaps a URI constructed from these?).

I fail in the third step. Is it possible to do this?

View 3 Replies View Related

Android :: Activity Events On StartActivity

Sep 28, 2010

Is there any event triggered on an activity when I call startActivity("activity_id", myIntent);

If the Activity exists already. I pass a parameter to the activity via i.putExtra("someID", someSerializableObject ); and would like to call a method to refresh a WebView. Right now, the call on startActivity brings the activity in the foreground but the webview does not display what i want.

View 1 Replies View Related

Android :: StartActivity -ForResult - At The Creation Of Main Activity

Mar 31, 2010

I would like to display a an access dialog activity at the start of my application.

In other words, I would like to start another activity (in dialog theme) as soon as my Main Activity is loaded. But, I know that I can not start an activity while another is creating.

I tried to start this activity in the onResume() method : I can see the new activity called, but the Main activity do not respond after closing the new activity.

Is there a solution to do this, without using delayed intent ? May i use a special flag for my intent ? I did not find, in the activity cycle, a way to detect the end of activity loading.

View 6 Replies View Related

Android :: Calling An Intent The Implicit Way

May 21, 2009

I`m trying to develop an application, just to test the ability of android to call an activity with an intent based not in the specific class name but specifying the action, category and data information. Acording to this link

http://developer.android.com/guide/topics/intents/intents-filters.html

only three aspects are consulted when comparing an intent object to select the future activity to run. I created two android projects (and two activities), the first is the main project who sends the request and the second can be called directly or through the filter. This is the call of the activity in the main project:

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

This is the part of the manifest that specifies (or at least I try to specify) in the secondary activity that it`s available to be selected to run with that information:

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

I installed both separatelly and I was expecteing to see the second activity after the called but instead I got an ActivityNotFoundException. By the way if I comment the t3.addCategory (Intent.CATEGORY_HOME); line and change the t3.setAction (Intent.ACTION_EDIT); to t3.setAction(Intent.ACTION_VIEW); the browser is executed so I think the problem is in the manifest of the second activity.

View 4 Replies View Related

Android :: URL Commands When Calling Youtube Through Intent?

Jul 12, 2009

The standard Youtube URL commands (&loop, &rel, etc) do not seem to work when calling Youtube via an INTENT from inside the android application. The videos play fine, Youtube app comes up fine, but the additional URL commands don't appear to work. Is there another set of commands I should be using or are commands simply ignored using Youtube in this manner. Also, is there any documentation on the interface from android to the Youtube app available on the net?

View 3 Replies View Related

Android : Droid Calling Intent From Another Class?

Jun 29, 2010

I am calling intents alot in my program and I thought that I could write a public class that would have all of my intents so I can just call something like intents.testIntent(params) and then have it fire off the intent.

I tried it out but am getting a force close with a null pointer exception. This is my whole class. I know it is probably sloppy but I have just been learning java for 2 months so I still am an amateur. Any way, my code...

View 1 Replies View Related

Android :: How To Get Calling Activity Instance From Called Activity?

Jul 9, 2010

I have a Contact Activity which is derived from ListActivity, which displays list of contacts, and on click of item, a new Activity Message Activity derived from ListActivity is initialized.Now I know, I can pack some information in Bundle and pass it before creating activity, but is there a way I can get instance of "ContactActivity" in onCreate method of "MessageActivity"?

View 1 Replies View Related

Android :: Calling Intent.getStringExtra() Throws StackOverflowError Periodically

Jan 25, 2010

I have an android application that I am supporting and after calling one of the activities numerous time, it throws a stackoverflowerror when trying to get the extras from the intent. Here is the the stack trace from when it crashes. Any ideas as to why after calling the activity at least 4 times the next time throws StackOverflowError when getting the extras from the intent?

The code used to build the intent is and contains String, String, boolean, Object:

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

And the code that is throwing the StackOverflowError is:
CODE:.........................

View 2 Replies View Related

Android :: How To Bring Existing Activity To Front Via Notification

Jul 28, 2010

I have one Android application, when it runs a service, I want to show the notification on the status bar. Then the user could navigate to other application by pressing HOME key. However when I try to bring the previous running application back to Front via notification icon, there is some problem with the existing activity. Even I declare it as "Single Top" mode (I want to run the existing activity since there is an associated service running) , somehow that activity's OnDestroy has been called before OnResume. Here is my code of creating the notification object.

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

View 1 Replies View Related

Android :: Calling Activity From Service

Nov 19, 2010

i am writing an app in which i need a background service to call an activity and show some result.

View 4 Replies View Related

Android : Error While Calling An Activity From Another / How To Fix

Apr 4, 2010

me and my partners are working on developing a pwa client for android Am getting an error while calling an activity from another activity.the error is as follows...

View 3 Replies View Related

Android :: Need To Take Into Account When Repeatedly Calling Same Activity?

Oct 28, 2010

I am developing an app where a single activity is instantiated multiple times by itself. I guess you could think of it like a book where each activity is a page. At the end of the page (activity) the user presses a button to go to a new page. I fire off an Intent for the same Activity, but I push different data into the Bundle so that a different page is loaded. This works fine, and I like the fact that the user can back up to a previous point, but my question is whether this will eventually be a problem? What happens if this activity is instantiated 10 times, or 50, or 100? Will the device run out of memory, will GC come along and clean up old activities, or what? If GC does clean them up, what happens when the user presses Back and the previous Activity is no longer on the stack? Is it better to keep track of the user's path, finish() the activity, and override the Back button so that whether the user is moving forward or backwards, I only load a single Activity? Another approach I could take is to refresh all the data on the page so that it's still the same activity, but with new data. The Back button would not work as expected in this case.

View 2 Replies View Related

Android :: How Can I Show My Activity On Top Of In-calling Screen?

Apr 23, 2010

I'm writing an android application which listens the phone calling events. What I want to do is, if there is a call incomes or outgoes, an activity shows with my customized info.I want to this screen keeps showing during the calling period. However, if a call is coming, the system UI which shows the contact always appears on top of my activity.I've found some apps already realized this function, but mine can't.

View 1 Replies View Related

Android :: Calling Finish() After Starting A New Activity

Apr 26, 2010

The first Activity that loads in my application is an initialization activity, and once complete it loads a new Activity. I want to ensure if the user presses 'Back' they go straight to the Launcher, and not the initialization screen. Side note, is this even the best approach, or would this be better done with some kind of Intent Flag?

Is it correct to call finish() after calling startActivity() on the new activity?

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

I'm still taking in the whole 'Message Queue' method of doing things in Android, and my assumption is that calling startActivity() and then finish() from my first Activity's onCreate() will log each respective message in the message queue, but finish execution of onCreate() before moving on to starting the next Activity and finishing my first one. Is this a correct understanding?

View 1 Replies View Related

Android :: Update Existing Preference-item In A PreferenceActivity Upon Returning From A Sub PreferenceScreen

Apr 12, 2010

I have a PreferenceActivity with a bunch of (Sub)PreferenceScreens. Each such (Sub)PreferenceScreen represents an account and has the account-username as its title.

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

As the user enters sub-PreferenceScreen, and edits the account user-name, I want the outer PreferenceScreen to update it's PreferenceScreen-title for the account in question.

I've tried to add...

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

But the accScreen.setTitle does not seem to take effect on the outer PreferenceScreen. I've note that calling onContentChanged(); actually makes it work, but I realize that this is probably not the preferred way of doing it.

I suspect I should call postInvalidate() on some view somewhere, but I really can't figure out on what view and when to do it.

http://stackoverflow.com/questions/2396153/preferencescreen-androidsummary-update may be experiening the same problem as me.

View 1 Replies View Related







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