Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android webview page reloading after capture picture and Upload in android 5+

I followed this to capture Images form camera in webview

Here at this part its fine in android some versions and in some devices its working fine

But at android 5.0.1 when I capture image from webview its capturing and reloading the page again in that I am again redirecting to Login page

So i am Unable to upload but where as in Huvai p9 its wokring fine with android 6+ its working fine It stays fine and uploads the Image can any one suggest me what to do

Update 1

Now I tried many other ways like this

But its not working in some devices Please Help but in some devices its working fine...

like image 814
Don't Be negative Avatar asked Oct 15 '16 07:10

Don't Be negative


2 Answers

According to me the activity that hosts the web view is destroyed as soon as you open the camera to take the picture. The camera is loaded in a separate activity, and this can cause the web view activity to be stopped and destroyed on devices with low memory.

Basically you have to manage this case, for example, in your onCreate where you will get a not null savedInstanceState bundle in case your activity has been destroyed and recreated. Check also the result that you get back in onActivityResult before loading content of the web view.

like image 75
Mimmo Grottoli Avatar answered Sep 27 '22 18:09

Mimmo Grottoli


I faced with a same problem. My mistake was that i was doing that.

protected void onStart() {
    super.onStart();
    browser.loadUrl(siteUrl);
}

But onStart sometime fires after you select a file.

Maybe it will help.

like image 31
Ec7ipse Avatar answered Sep 27 '22 20:09

Ec7ipse