Android : Need To Get Result Back From Activity?

Mar 10, 2010

I'm doing some network job in AsyncTask. Sometimes it requires communication with user. (connection is dropped, session is expired and so on). I want to pop up a dialog or launch an Activity, and then, depending on user's input, stop the job or redo it. I can launch any Activity from AsyncTask, but how to get result back? It seems to be possible only if I launch new Activity from another Activity. What are possible solutions?

Android : Need to Get result back from Activity?


Android :: How To Pass Result From Activity Terminated By BACK Button?

Apr 20, 2010

I am trying to setResult after the BACK button was pressed. I call in onDestroy. So, how can I pass result from activity terminated by BACK button?

View 2 Replies View Related

Android : Can I Get Result From A Sub Activity?

Aug 5, 2010

When user presses a button from a webview, I open a scrollview activity with some buttons and edittext fields.

Once the user enters the fields and presses the 'create' button, from scrollview activity, I want the results from the called activity to be accessible. How can I do thi?

View 1 Replies View Related

Android :: Start Activity From Service - And Getting Result From It

Feb 11, 2010

I have a Service which needs to receive data from external packages. So, to locate the data providing external packages, I use activity- filter and PackageManager.queryIntentActivities function to locate the interesting packages. Now, from each such package, I need to get a ContentProvider URI. So I want to start the external Activity and the external activity will return a result to my service - something like "startActivityForResult". The problem is that there is no way to call "startActivityForResult" from a Service, only Activity can do that, and my project does not have any Activity, and probably can't show UI for the user.

The bottom line: Can anyone suggest a way to get ContentProvider URI from an external package, while my package has only a Service?

View 22 Replies View Related

Android :: Get Mail Sent Notification In Activity Result

Aug 30, 2010

I am launching a mail activity by
//Sending mail final int SENT_MAIL = 1;
startActivityForResult(Intent.createChooser(i, "Send mail"),SENT_MAIL);
and in
onActivityResult(int req, int res,Intent data)

I am trying to find the result of email sending, so as to confirm if my mail was sent or was discarded by the user. I am receiving null for Intent data.
i.e. data =null
parameter in onActivityResult(int req, int res, Intent data), res is always 0.
ie. res = 0;

View 1 Replies View Related

Android :: How Does Service Return Result To Activity

Oct 1, 2010

i seem to have a classic task, yet i can't find any examples on how to do it.i want to download something. well i call a web service and get a response but its pretty much the same.in order to do this i have an activity that starts a service that spawns a thread that does the job.now i would like to use the data i got in the activity that started the service.(i assume that starting another activity to handle the job of displaying the result would be simple)my problem is how does the service notify an activity (the one that started it or another one) of something.

View 1 Replies View Related

Android : Way To Get Result From Settings Activity Intent?

May 4, 2009

I am currently trying to launch a GPS settings activity using startActivityForResult....however it never seems to be calling my onActivityResult function after it exits. I noticed the docs mentioned that some Intent protocols are not defined to return a result, is this one such example? are there any flags that I could set to either make the settings activity call onActivityResult, or even better make my activity block until the launched activity returns?

View 5 Replies View Related

Android : Receive CameraActivities Result In A Different Activity?

Mar 12, 2010

I hope the title says it all: I've got Activity A which fires up the Camera intent via:

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, REQUEST_CAMERA);

After the picture is taken I can easily grab the picture in:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)

But I'd like to receive the result in Activity B in which the image can be edited.
Right now I'm receiving the result in Activity A and pass it over to Activity B which results in showing the GUI of Activity A for a short while:

Intent i = new Intent().setAction("DisplayJPEG");
i.setClass(this, EditImageActivity.class);
i.putExtra("IMAGE_URI", uri);
startActivityForResult(i, REQUEST_EDIT_IMAGE);

Of course, I will need the result from Activity B in Activity A after the image has been edited. But that should work with:

setResult(resultCode, data);

So there has to be a way to do what I need. Please point me into the right direction.

View 3 Replies View Related

Android :: Analog Of Start Activity For Result For Service

Jul 14, 2010

Despite similar question was asked, I have differnet situation: My app consists mostly of a background Service. I want to start external activities and get results back.I see several options:Create dummy Activity and keep reference to it for using its startActivityForResult. This consumes quite a lot of memory, as we know. Use Broadcast Intents instead of Android's results infrastructure: ask client activities to broadcast their results before closing. This kind of breaks the idea and not so performance-efficient. Use Instrumentation directly - try to copy code from startActivityForResult into my Service. Use Service interfaces - serialize and add AIDL connection to the Intent for starting an Activity. In this case Activity should call Service directly instead of providing result. The third approach feels closer to Android for me, but I'm not sure if it's possible to do - Service does not have its Instrumentation, and default implementation seems to always return null.

View 1 Replies View Related

Android :: Get Result From Search Manager To Main Activity

Nov 18, 2010

Activity A is main activity. Whereas Activity B is SearcActivity (Search Manager). Activity B is List Activity, so whatever result comes, result is displayed in the list. Once user clicks on the list, I want to get that list selected item to be returned to ActivityA.What I did. Code...

View 3 Replies View Related

Android : Return A Result (startActivityForResult) From A TabHost Activity?

Mar 23, 2010

I have 3 classes in my example:
Class A, the main activity. Class A calls a startActivityForResult:

Intent intent = new Intent(this, ClassB.class);
startActivityForResult(intent, "STRING");

Class B, this class is a TabActivity:

Intent intent = new Intent(this, ClassC.class);
tabHost.addTab...

Class C, this class is a regular Activity:

Intent intent = this.getIntent();
intent.putExtra("SOMETHING", "EXTRAS");
this.setResult(RESULT_OK, intent);
finish();

onActivityResult is called in Class A, but the resultCode is RESULT_CANCELED instead of RESULT_OK and the returned intent is null. How do I return something from the Activity inside a TabHost?

I realize that the problem is that my Class C is actually running inside of Class B, and Class B is what is returning the RESULT_CANCELED back to Class A. I just don't know a work around yet.

View 4 Replies View Related

Android : Forward Activity Result To Parent With SingleTop Launch Mode?

Jun 1, 2010

I have two activities: a MainListActivity, and a DetailViewActivity. DetailViewActivity is set with android:launchMode="singleTop".

When clicking an item in the "main list" activity, it launches the "detail view" activity via:

startActivityForResult(detailIntent, REQUEST_CODE_DETAIL);

If I then call setResult(RESULT_OK, resultData); and finish(); from within the Detail activity, that resultData is received by the "main list" activity's onActivityResult(..) method correctly.

However, if I implement a "see previous"/"see next" type of navigation within the Detail activity, and implement it using singleTop, that result no longer gets sent back to the initial activity:

Intent nextItemIntent = this.createIntent(nextId);
nextItemIntent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
startActivity(nextItemIntent);
// at this point, my DetailActivity's onNewIntent() method is called, and the new data is loaded properly

But from here, when I call setResult(..) and finish(), my MainList activity never receives the new/updated result. Anyone know what I'm doing wrong?

View 1 Replies View Related

Android : Default SMS Activity Result Code Coming As RESULT_CANCELED Even SMS Is Received Successfully

Jul 20, 2010

I am invoking the default SMS activity by using the following code-

intent = new Intent(Intent.ACTION_VIEW, Uri.parse("sms:")); intent.putExtra("sms_body", "SMSText"); startActivityForResult(intent, 11); //Here 11 is my request code

The SMS activity gets opened in emulator (5554), i type the number 5556 (device number of my second emulator) and click on "Send"

The SMS is received in second emulator(5556) successfully. I click back on 5554 (my SMS generating emulator )and come back to my application. I notice that the onActivityResult method is getting called successfully as desired.

When i check for the result code i get it as RESULT_CANCELED ( 0 ) instead of RESULT_OK (-1). The data is also coming as null.

View 3 Replies View Related

Android :: Start An Activity And Return Back To Original Activity

Jan 26, 2009

I have an application with contains multiple activities. The main activity will start the others ( use startActivity() ) depends on user event, when an activity close, it calls finish() and return back to main activity. It appears to behavior like that.

However, the "problem" I see is main activity's onCreate function is called every time. I think the the main activity should be placed in the activity stack and simply push to front when others exit, therefore only onResume, onStart are called. Is there some flag I need to set or I misunderstand the activity behaviro?

In child activity, besides calling finish() or startActivity for main activity, what is other way to move main activity to front?

View 2 Replies View Related

Android :: How To Clear Activity From Second Activity Going Back To Home Screen?

Mar 3, 2010

example scenario is: from login screen - main screen - then when i clicked a hide button the app will go to home screen, and when im going to click the app again the main screen would be called.

View 2 Replies View Related

Android :: Back To Activity When Call Is Done

Nov 24, 2010

I am launching an activity to make a phone call, but when I pressed the 'End Call' button, it does not go back to my activity. Can you please tell me how can I launch a call activity which comes back to me when 'End Call' button is pressed?

View 5 Replies View Related

Android :: Back Button Activity

Aug 25, 2010

I was wondering how or if it is possible to exclude activities from the back buttons history list? For example not letting the user back into the Splash Screen?

View 2 Replies View Related

Android :: Back To Activity After WebView?

Nov 14, 2009

I've been searching and looking for this answer for quite some time now. I want to display a little HTML in a webView.

When the User read the HTML, he's supposed to use the back button to go back to the previous activity. However, it closes the App.

How can I make it go back to the last Activity? It would also be ok to display a soft back button or something. Here my code...

View 2 Replies View Related

Android : Activity And Back Button

Nov 2, 2010

on the ui i am having a back button displayed. there are three activities say A,B,C. Activity A is splash screen. Activity B is home screen. Activity C is edit screen. on edit screen only i am having a back button. when the user press that i open the activity B which also contains some sort of http request and response. i want that the previous activity from stack should get displayed? how can i achieve that? i am able to open previous activity on pressing the back button of device? when i press back button on device there doesnt goes any http request? i want to achieve this behaviour when i press the ui back button.

View 2 Replies View Related

Android : Back Button And Last Activity

Aug 17, 2010

My app chains some activities.

if you press the back button, you go back through old activities then you suddenly quit the application !

so I need to show a message like "do you really want to exit" if it's the last activity on stack

I know how to override the back button but i can't figure how to know how many activity are in history

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

View 1 Replies View Related

Android : Back Key Destroy An Activity

Jul 14, 2010

I have an activity defined as below:

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

A strange thing is that, when running on emulator, and the back key is pressed, the activity was destroyed (I saw onDestroy() called in log). But when running on my Nexus One phone, and the back key is pressed, the activity is not destroyed (I didn't see onDestroy() called in log).

View 1 Replies View Related

Android :: Any Way To Go 2 Steps Back In Activity Stack?

Apr 7, 2010

Android - Can I force BACK button to go 2 steps back in the Activity stack with some kind of code? I know I can override the onKeyDown method but I want BACK to do it's thing, just twice!

View 3 Replies View Related

Android :: Hide Activity On BACK Key Without OnDestroy?

Oct 28, 2009

When user presses BACK key, my activity's onDestroy is called and then it is killed. Is there a way (by overridding Activity.onKeyDown??) to simply put the activity into background without killing it? I want the BACK key to act like the HOME key (which doesn't kill my app), except I want to show the activity immediately below my activity.

View 7 Replies View Related

Android :: Start Browser Then Go Back To My Activity

Jan 29, 2009

Our application has a fair amount of java script. As far as we known, WebView widget doesn't handle AJAX, therefore we want to bring up the brower to load the url. The problem is, after user done with browser, how can it goes back to where it left in our application? ( when user quit the browser, our application will show up the activity before went to browser)

View 2 Replies View Related

Android :: How To Come Back Main Activity From Child One?

Mar 30, 2010

I'm in a small problem.i have three activities (suppose A,B,C) after performing onclick event in activity A, i can go to activity B and then C..my question is that is there any way to comeback activity A from C..here is the code snippet public void on Create(Bundle Code...

View 3 Replies View Related

Android :: Star Activity And Back Button

Oct 22, 2009

I am starting an external activity from my application and would like the back button to return the user to the point in my application where they started the activity. is this possible?

View 7 Replies View Related

Android :: How To Manipulate Activity Back Stack?

Nov 22, 2010

I want to implement the following logic. I have 4 activites A, B, C and D. The flow is A -> B -> C -> D When the user navigates from A -> C he should be able to get back to the previous activities by pressing the back button. But after reaching D pressing the back button should take him to activity A. And pressing the back button againg should exit the application instead of taking him back to B / C / D. How do I do it.

View 1 Replies View Related

Android :: Does Pressing Back Always Cause Activity To Finish()?

May 10, 2010

I've heard that pressing the back button will essentially cause the current Activity to finish(). Is this always the case? Seems like it would be with the way it pops the Activity off the stack.

The one situation I'm not so sure about is when the root Activity in a Task has back pressed. I'm currently experiencing a very weird effect, described as follows:

On loading my application, the first Activity is for initialization, and once it finishes, it calls my main Activity (a TabActivity). This first init activity has android:noHistory="true" set in the Manifest so pressing Back from my main Activity won't go back to that. It goes to the Launcher. When I click on my App in the Launcher a second time, the initialization activity loads again, and loads the main Activity when done. Almost immediately after, it loads a second instance of my main Activity. But ONLY after the Application has already been run once, and was exited by pressing BACK from the main Activity. It does it every subsequent time until I force quit the app or load a new version from the IDE.

Based on this, I am suspecting some kind of Activity instance is lying around and being reused, since it only happens on the second+ time I run the application (and exit with BACK -- using HOME just returns to the last state of the app, no big deal).

View 4 Replies View Related

Android :: Moving Back To A Specific Activity Always

Feb 4, 2009

I've got four activities

A, B, C and D where A is the main entry screen.

No matter how I navigate to B, C or D (via A->B or A->C-B etc), I want the back button to always go to activity A. What flag can I set to do this specifically?

View 2 Replies View Related

Android : Back Button Not Stopping Activity

Feb 28, 2009

In my game, I've got one activity starting another activity via an intent. When the user is finished with the second activity, they quit it using the back button. However, I have a problem: when this happens, the second activity is still running, even if it's quit with the back button.

My second activity will eventually give a "game over" message using a pop up window if there is no user input for a period of time. Problem is, when I back out of the second activity (where the game is happening) the "game over" message still appears eventually. This is how I know the second activity is still running. It even displays a "game over" message if my entire app is quit (on the Android OS).

How do I stop an activity completely when the user presses the back button?

View 3 Replies View Related







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