Thursday, 15 April 2010

android - failure to delivere result code in onActivityResult in case of fragment -



android - failure to delivere result code in onActivityResult in case of fragment -

having result code problem in case of fragment when trying perform action_pick gallery , , getting result code null pointer exception. please can solve out this.... here part of code...

con_imgview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent myintent = new intent(intent.action_pick, android.provider.mediastore.images.media.external_content_uri); startactivityforresult(myintent, 1); } });

and logcat msg:

06-18 03:13:36.610: e/androidruntime(1032): java.lang.runtimeexception: failure delivering result resultinfo{who=android:fragment:0, request=1, result=0, data=null} activity {org.sipdroid.sipua/org.sipdroid.sipua.ui.mainactivity}: java.lang.nullpointerexception 06-18 03:13:36.610: e/androidruntime(1032): @ android.app.activitythread.deliverresults(activitythread.java:3346)

this code working in activity bot not working in fragment. have solution...plz

yuo can do

getactivity().startactivityforresult(myintent, 1);

and handle result in activity

or can leave code , override fragment's onactivityresult

android android-fragments

No comments:

Post a Comment