android - onActivityResult in dialog fragment -


i'm taking photo dialog fragment. , need startactivityforresult(takepictureintent, actioncode);

@override     public void onactivityresult(int requestcode, int resultcode, intent imagereturnedintent) {         super.onactivityresult(requestcode, resultcode, imagereturnedintent);         switch (requestcode) {             case select_photo:                 getactivity();                 if (resultcode == activity.result_ok) {                     uri selectedimage = imagereturnedintent.getdata();                     string[] filepathcolumn = { mediastore.images.media.data };                     cursor cursor = getactivity().getcontentresolver().query(selectedimage, filepathcolumn, null, null, null);                     cursor.movetofirst();                     int columnindex = cursor.getcolumnindex(filepathcolumn[0]);                      setpic();                 }                 break;             case action_take_photo_b: {                 getactivity();                 if (resultcode == activity.result_ok) {                     handlebigcameraphoto();                  }                 break;             }         }        } 

bu method not being called. there method can used in dialog fragment??

try :

to start activity fragment :

getactivity().startactivityforresult(intent, code); 

to result in fragment :

in parent activity (fragment call activity) :

@override protected void onactivityresult(int requestcode, int resultcode, intent data) {      fragmentobject             .onactivityresult(requestcode, resultcode, data); } 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -