0

Why not working choose file option in webview?I have a wordpress website ,i used contactform7 plugin for upload-file option.but when , click on choose-file button in webview , this is not working.

MainActivity.java

import android.graphics.Bitmap;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebChromeClient;
import android.webkit.ValueCallback;
import android.content.Intent;

public class MainActivity extends AppCompatActivity {
    private WebView myWebView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        myWebView = (WebView)findViewById(R.id.webView);
        WebSettings webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        myWebView.loadUrl("http://grocerydoorstep.com");
        myWebView.setWebViewClient(new CustomWebViewClient());
    }

    public class CustomWebViewClient extends WebViewClient {

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            findViewById(R.id.progressBar1).setVisibility(View.VISIBLE);
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            findViewById(R.id.progressBar1).setVisibility(View.GONE);
        }

    }
    public void onBackPressed() {
        if (myWebView.canGoBack()) {
            myWebView.goBack();
        } else {
            super.onBackPressed();
        }
    }
}
ArK
  • 20,698
  • 67
  • 109
  • 136

1 Answers1

0

Hi,maybe this link will be useful to you. Kindly check it out file chooser inside Webview In the above link they explained about how to pick a file and how to capture a file using camera and get its path from Webview .

Senthilvel S
  • 331
  • 1
  • 7
  • 21