onActivityResult do not fire if launch mode of activity is singleInstance
I believe that the problem is that singleInstance doesn't let the callee activity to exist in the same task as the caller, hence it can't return the value to the caller.
Consider using singleTask instead:
singleTask
The system creates the activity at the
root of a new task and routes the
intent to it. However, if an instance
of the activity already exists, the
system routes the intent to existing
instance through a call to its
onNewIntent() method, rather than
creating a new one.
singleInstance
Same as "singleTask", except that the
system doesn't launch any other
activities into the task holding the
instance. The activity is always the
single and only member of its task.
http://developer.android.com/guide/topics/manifest/activity-element.html
onActivityResult With launchMode=singleTask?
The docs of the startActivityForResult
say:
For example, if the activity you are launching uses the singleTask launch mode,
it will not run in your task and thus you will immediately receive a cancel result.
It seems there is no way to get around this.
If you are the developer of called Activity, then you can have it send a broadcast when some result is available. The calling Activity can then list to this broadcasts.
android:launchMode=singleInstance' does not allow activity for results update
Yes, even I faced the same problem. That's why I was not able to use Activity for results with the launch mode as a single instance as I found I get the call on onActivityResult as the acivity B starts.
singleTask launch mode is not working
So it seems the issue is with device. On emulator and other devices with same android version singleTask works just fine.
OnActivityResult not executed
There are 2 possible solutions:
- You should try with request code larger than 0.
- Does your activity contain singleInstance or singleTask launchMode? check this issue .
Related Topics
Should The Call to The Superclass Method Be The First Statement
App Links Intent Filters in Assetlinks.JSON Not Working on Android
Why Is Fusedlocationapi.Getlastlocation Null
Hide Tablayout on Scroll of Content Instead of Toolbar
How to Change Color of Vector Drawable Path on Button Click
Not Seeing Nexus7 in Eclipse's Android Devices
How to Access Resource with Dynamic Name in My Case
List View Item Swipe Left and Swipe Right
Using Audiotrack in Android to Play a Wav File
Change The Background Color of Cardview Programmatically
Set Textcursordrawable Programmatically
Android: Wait on User Input from Dialog
How to Add Radio Button Dynamically as Per The Given Number of Counts
How to Fetch Data from a Web Server in an Android Application
Remove Unwanted White Space in Webview Android
Replace Fragment with Another Fragment Inside Viewpager