Null intent in onActivityResult(int requestCode, int resultCode, Intent data)
-
I'm starting an Activity for result. And on that Activity's onBackPressed() event I'm setting the intent and result. @Override public void onBackPressed() { super.onBackPressed(); Intent intent = new Intent(BrowseSome.this, ConfigurationSome.class); intent.putParcelableArrayListExtra("SomeList", somethings); setResult(RESULT_OK, intent); } But in my onAcivityResult(int requestCode, int resultCode, Intent data) I'm getting null Intent. Why is it so? Earlier is used to do this on a Button click event and it worked fine. But i have removed this button from the activity and now i want the result to be set onBackPressed() event. -Thanks
-
Answer:
your call to super.onBackPressed(); is preventing the code below it from being called (it calls finish() on your activity). Try rearranging your code to: @Override public void onBackPressed() { Intent intent = new Intent(BrowseSome.this, ConfigurationSome.class); intent.putParcelableArrayListExtra("SomeList", somethings); setResult(RESULT_OK, intent); super.onBackPressed(); }
GamDroid at Stack Overflow Visit the source
Related Q & A:
- Facebook share intent android?
- How to convert a char array into an int in C++?Best solution by Stack Overflow
- Is using `int` more preferable than using `unsigned int`?Best solution by Stack Overflow
- How long does Standard Int'l Flat Rate Shipping take to get to Canada?Best solution by answers.yahoo.com
- What is the concept of criminal intent?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.