I'm having a similar problem.  Like you, I have an Activity A starting
Activity B via startActivityForResult().  And, like you, my Activity B
uses a Theme.Dialog so that Activity A is still visible underneath B
while B is active.

When I change the orientation of the handset while B is active, I can
see that A gets destroyed and recreated underneath B.  My problem has
nothing to do with crashing.  Instead, when A gets destroyed and
recreated, the savedInstanceState that is passed to onCreate for A
doesn't have the data in it that I had saved away in A's
onSaveInstanceState().  And yes, I confirmed that if B is not on top
of A during the orientation change, the savedInstanceState does
contain my data. It's kind of a minor problem that I can work around,
but is indeed odd, and I wonder if that is somehow related to your
crash.


On Nov 24, 3:10 pm, "Dianne Hackborn" <[EMAIL PROTECTED]> wrote:
> I don't believe that is the complete stack crawl; there should be a "caused
> by:" line with additional parts of the stack that show who actually get the
> NPE; what is shown here is just the framework catching that underlying
> problem and wrapping it with more information:
>
>     private final void deliverResults(ActivityRecord r, List<ResultInfo>
> results) {
>         final int N = results.size();
>         for (int i=0; i<N; i++) {
>             ResultInfo ri = results.get(i);
>             try {
>                 if (ri.mData != null) {
>
> ri.mData.setExtrasClassLoader(r.activity.getClassLoader());
>                 }
>                 r.activity.dispatchActivityResult(ri.mResultWho,
>                         ri.mRequestCode, ri.mResultCode, ri.mData);
>             } catch (Exception e) {
>                 if (!mInstrumentation.onException(r.activity, e)) {
>                     throw new RuntimeException(
>                             "Failure delivering result " + ri + " to
> activity "
>                             + r.intent.getComponent().toShortString()
>                             + ": " + e.toString(), e);
>                 }
>             }
>         }
>     }
>
>
>
> On Mon, Nov 24, 2008 at 1:23 PM, j <[EMAIL PROTECTED]> wrote:
>
> > W/dalvikvm( 4397): threadid=3: thread exiting with uncaught exception
> > (group=0x4
> > 0013e28)
> > E/AndroidRuntime( 4397): Uncaught handler: thread main exiting due to
> > uncaught exception
> > E/AndroidRuntime( 4397): java.lang.RuntimeException: Failure
> > delivering result ResultInfo{who=null, request=1, result=-1,
> > data=Intent { action=orative }} to act
> > ivity {com.cisco.uc.cumc/com.cisco.uc.cumc.HomeScreen}:
> > java.lang.NullPointerException
> > E/AndroidRuntime( 4397):        at
> > android.app.ActivityThread.deliverResults(ActivityThread.java:2839)
> > E/AndroidRuntime( 4397):        at
> > android.app.ActivityThread.handleSendResult(ActivityThread.java:2881)
> > E/AndroidRuntime( 4397):        at android.app.ActivityThread.access
> > $2300(ActivityThread.java:112)
> > E/AndroidRuntime( 4397):        at android.app.ActivityThread
> > $H.handleMessage(ActivityThread.java:1608)
> > E/AndroidRuntime( 4397):        at android.os.Handler.dispatchMessage
> > (Handler.java:88)
> > E/AndroidRuntime( 4397):        at android.os.Looper.loop(Looper.java:
> > 123)
> > E/AndroidRuntime( 4397):        at android.app.ActivityThread.main
> > (ActivityThread.java:3742)
> > E/AndroidRuntime( 4397):        at
> > java.lang.reflect.Method.invokeNative(NativeMethod)
> > E/AndroidRuntime( 4397):        at java.lang.reflect.Method.invoke
> > (Method.java:515)
> > E/AndroidRuntime( 4397):        at com.android.internal.os.ZygoteInit
> > $MethodAndArgsCaller.run(ZygoteInit.java:739)
> > E/AndroidRuntime( 4397):        at
> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
> > E/AndroidRuntime( 4397):        at dalvik.system.NativeStart.main
> > (Native Method)
>
> > On Nov 24, 12:29 pm, "Dianne Hackborn" <[EMAIL PROTECTED]> wrote:
> > > What is the stack crawl of the crash?
>
> > > On Mon, Nov 24, 2008 at 11:57 AM, j <[EMAIL PROTECTED]> wrote:
>
> > > > I have this scenario:
> > > > 1) activity A starts activity B via startActivityForResult.
> > > > 2) User changes orientation which triggered activity B to be destroyed
> > > > and its onCreate method to be called a second time.
> > > > 3) Activity B calls setResult(...) and that crashes.
>
> > > > It seems activity B no longer knows who to return to the result to.
> > > > Is it possible to save info into the Bundle via  onSaveInstanceState
> > > > so that activity B can remember who called it?
>
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > [EMAIL PROTECTED]
>
> > > Note: please don't send private questions to me, as I don't have time to
> > > provide private support.  All such questions should be posted on public
> > > forums, where I and others can see and answer them.
>
> --
> Dianne Hackborn
> Android framework engineer
> [EMAIL PROTECTED]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support.  All such questions should be posted on public
> forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to