jquery mobile - Android opening new page after onActivityResult -
for html5 - jquery mobile android app use native code access camera. have succeeded in getting images camera , showing them on local webpage. problem i'm experiencing when camera intent closes web page seems reopen second time time javascript isn't executed. when press button on device redirected right page again.
how can keep page opening twice?
i'm using following code access camera:
mwebview.addjavascriptinterface(new object() { @suppresslint("simpledateformat") public void performclick() { intent cameraintent = new intent( android.provider.mediastore.action_image_capture); string timestamp = new simpledateformat("yyyy.mm.dd_hh.mm.ss") .format(new date()); img = new file(app_location + file.separator + "images", timestamp + ".jpg"); img_location = uri.fromfile(img); cameraintent.putextra(mediastore.extra_output, img_location); startactivityforresult(cameraintent, camera_pic_request); } }, "opencamera"); @suppresslint("simpledateformat") @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (requestcode == camera_pic_request) { if (resultcode == result_ok) { if (data != null) { storeimage(data.getdata(), img); } else { storeimage(img_location, img); } // call javascript function display image on webpage mwebview.loadurl("javascript:setimage(\"" + img_location + "\")"); } } }
add activity tag in manifest file
android:configchanges="orientation|keyboardhidden"
Comments
Post a Comment