my problem was calling super() first before doing the setresult call

On Jul 14, 7:40 pm, john <[email protected]> wrote:
> try setResult(RESULT_CANCELED);
>
> add
> if (resultCode==RESULT_OK) {
> .........}
>
> in SporeAPI.onActivityResult
> On 7月15日, 上午5時46分, schwiz <[email protected]> wrote:
>
> > ahh ok yeah it is showing an uncaught exception for not returning the
> > result along with more errors
>
> > 07-14 21:42:54.501: INFO/ActivityManager(570): Starting activity:
> > Intent { comp={net.schwiz.sporedemo/net.schwiz.sporedemo.ChangeNumber}
> > (has extras) }
> > 07-14 21:42:54.551: DEBUG/SporeAPI(713): onPause called
> > 07-14 21:42:55.101: INFO/ARMAssembler(570): generated
> > scanline__00000077:03515104_00000000_00000000 [ 27 ipp] (41 ins) at
> > [0x286540:0x2865e4] in 912686 ns
> > 07-14 21:42:55.171: INFO/ARMAssembler(570): generated
> > scanline__00000077:03515104_00001001_00000000 [ 64 ipp] (84 ins) at
> > [0x2865e8:0x286738] in 1894934 ns
> > 07-14 21:42:55.222: INFO/ActivityManager(570): Displayed activity
> > net.schwiz.sporedemo/.ChangeNumber: 712 ms
> > 07-14 21:42:57.722: DEBUG/AndroidRuntime(713): Shutting down VM
> > 07-14 21:42:57.751: WARN/dalvikvm(713): threadid=3: thread exiting
> > with uncaught exception (group=0x4000fe70)
> > 07-14 21:42:57.789: ERROR/AndroidRuntime(713): Uncaught handler:
> > thread main exiting due to uncaught exception
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):
> > java.lang.RuntimeException: Failure delivering result ResultInfo
> > {who=null, request=1, result=0, data=null} to activity
> > {net.schwiz.sporedemo/net.schwiz.sporedemo.SporeAPI}:
> > java.lang.NullPointerException
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > android.app.ActivityThread.deliverResults(ActivityThread.java:3005)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > android.app.ActivityThread.handleSendResult(ActivityThread.java:3047)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > android.app.ActivityThread.access$2300(ActivityThread.java:112)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1721)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > android.os.Handler.dispatchMessage(Handler.java:99)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > android.os.Looper.loop(Looper.java:123)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > android.app.ActivityThread.main(ActivityThread.java:3948)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > java.lang.reflect.Method.invokeNative(Native Method)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > java.lang.reflect.Method.invoke(Method.java:521)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
> > (ZygoteInit.java:782)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > dalvik.system.NativeStart.main(Native Method)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713): Caused by:
> > java.lang.NullPointerException
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > net.schwiz.sporedemo.SporeAPI.onActivityResult(SporeAPI.java:163)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > android.app.Activity.dispatchActivityResult(Activity.java:3595)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     at
> > android.app.ActivityThread.deliverResults(ActivityThread.java:3001)
> > 07-14 21:42:57.921: ERROR/AndroidRuntime(713):     ... 11 more
>
> > On Jul 14, 4:12 pm, Dianne Hackborn <[email protected]> wrote:
>
> > > You said it was crashing.  I'm not sure what you mean by crashing, because
> > > you didn't say a whole lot, but generally when an app crashes this is due 
> > > to
> > > an uncaught exception and that exception will be found in the log.
>
> > > On Tue, Jul 14, 2009 at 1:41 PM, schwiz <[email protected]> wrote:
>
> > > > Im not sure what you mean by the stack crawl when I press the button
> > > > to load the new activity logcat says
>
> > > > I 570 ActivityManager Starting activity:Intent {camp=
> > > > {net.schwiz.sporedemo/net.schwiz.sporedemo.ChangeNumber} (has
> > > > extras) }
> > > > I 570 ActivitManager Displayed activity
> > > > net.schwiz.sporedmeo/.ChangeNumber: 775 ms
>
> > > > On Jul 14, 3:27 pm, Dianne Hackborn <[email protected]> wrote:
> > > > > What is the stack crawl on the log output?
>
> > > > > On Tue, Jul 14, 2009 at 1:07 PM, schwiz <[email protected]> wrote:
>
> > > > > > Ok so I am working on an app and I use startActivityForResult but
> > > > > > currently if you press the back button on the new activity it will
> > > > > > crash my app.  In my new activity I have
>
> > > > > >       �...@override
> > > > > >        public boolean onKeyDown(int keyCode, KeyEvent event) {
> > > > > >                // TODO Auto-generated method stub
> > > > > >                super.onKeyDown(keyCode, event);
> > > > > >                if(keyCode == KeyEvent.KEYCODE_BACK){
> > > > > >                        setResult(RESULT_OK);
> > > > > >                }
> > > > > >                return true;
> > > > > >        }
>
> > > > > > but that didn't fix the problem, how do I fix 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, and so won't reply to such e-mails.  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, and so won't reply to such e-mails.  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