xamarin - Android 4.4.2 crash during picking image -
during developing application in xamarin android encountered strange error. pick image/video (whether camera or documents ui) application crashes no error. scenario open application, make steps activity, images chosen, , open camera or document ui standard way:
public void choosemediaaftertypechose (bool photo, bool camera) { try { string title = ""; int id; intent iintent; if (camera) { if (photo) { iintent = new intent("android.media.action.image_capture"); id = const.and_pickimageid_camera; app._file = new file (app._dir, "myphoto.jpg"); iintent.putextra (android.provider.mediastore.extraoutput, uri.fromfile (app._file)); } else { iintent = new intent("android.media.action.video_capture"); id = const.and_pickvideoid_camera; app._file = new file (app._dir, "myvideo.mp4"); iintent.putextra (android.provider.mediastore.extraoutput, uri.fromfile (app._file)); } } else { iintent = new intent (); iintent.setaction (intent.actiongetcontent); if (photo) { iintent.settype ("image/jpg"); title = static.maindata.currenttexts.choosephoto; id = const.and_pickimageid_galery; } else { iintent.settype ("video/mp4"); title = static.maindata.currenttexts.choosevideo; id = const.and_pickvideoid_galery; } } if (camera) { startactivityforresult (iintent, id); } else { startactivityforresult (intent.createchooser (iintent, title), id); } } catch (exception ex) { showerror (static.maindata.currenttexts.mediaerror); w.l(ex.message); } }
the chosen application crashes during image/video picking (e.g. during browsing images in gallery wthout picking any). when happens never method in our code.
what have:
- when user don't pick photos, application runs without memory crash
- sometimes picking proceedes without error.
- we think issue on android 4.4.2 (it happend on devices android - on other android version devices didn't encounter it)
what tried:
- we put permissions manifest (read/write external storage, hardware.camera etc.)
- we delete memory stored content save memory
- all activities unload memory when leave screen
- logcat says every process connected (application , active application) died no trace error
our question if stumbled similar issue , how handle it. second question if there way find out whats happening.
edit:
app._dir code added.
app._dir = new java.io.file ( environment.getexternalstoragepublicdirectory ( environment.directorypictures), "camera"); if (!app._dir.exists ()) { app._dir.mkdirs( ); }
Comments
Post a Comment