Android
12
Вклад в тег
private ValueCallback<Uri[]> uploadMessageAboveL;
private Uri uri;
...
zwv.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onShowFileChooser(WebView view, ValueCallback<Uri[]> filePath, WebChromeClient.FileChooserParams fileChooserParams) {
uploadMessageAboveL = filePath;
uri = generateFileUri();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
startActivityForResult(intent, FILE_CHOOSER_RESULT_CODE);
return true;
}
});
...
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
...
Uri[] results = null;
if (resultCode == Activity.RESULT_OK) {
results = new Uri[1];
results[0] = uri;
}
uploadMessageAboveL.onReceiveValue(results);
}