Code for Web view support upload


webview1.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback, FileChooserParams fileChooserParams) {

mFilePathCallback = filePathCallback; 
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); 
intent.setType("*/*"); 
startActivityForResult(intent, PICKFILE_REQUEST_CODE); return true;
}
});

//add Bkock webview loadUrl


}
private ValueCallback <Uri[]> mFilePathCallback;
private static final int PICKFILE_REQUEST_CODE = 0; 
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == PICKFILE_REQUEST_CODE) {
Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
Uri[] resultsArray = new Uri[1]; 
resultsArray[0] = result; 
mFilePathCallback.onReceiveValue(resultsArray);
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.