I have a webview in my app. there is a browse(to upload files) button in a web page. When I test the app in HTC (Android 4.0.3) it is working but in Galaxy S3 (Android 4.1.1) it's not working.
I won't get the file chooser menu. Apparently button is not clickable instead when I touch anywhere of the screen I get
"singleCursorHandlerTouchEvent -getEditableSupport FASLE".
I have tried all the posible solutions.
// Profile web view
mWebView = (WebView) findViewById(R.id.itemWebView);
//improve the speed
mWebView.getSettings().setRenderPriority(RenderPriority.HIGH);
mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setSupportZoom(false);
//setup the file chooser
mWebView.setWebChromeClient(new WebChromeClient() {
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
ProfileActivity.this.startActivityForResult(Intent.createChooser(i, "Image Chooser"),FILECHOOSER_RESULTCODE);
}
@SuppressWarnings("unused")
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {
openFileChooser(uploadMsg);
}
@SuppressWarnings("unused")
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
openFileChooser(uploadMsg);
}
});
This is my onActivityResult function
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
if (requestCode == FILECHOOSER_RESULTCODE) {
if (null == mUploadMessage)
return;
Uri result = intent == null || resultCode != RESULT_OK ? null
: intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
} else {
System.out.println("Something else->" + requestCode);
}
}
In my jQuery mobile webpage I have a simple form:
<form id="edit" method="post" enctype="multipart/form-data" data-ajax="false" action = "profile_myimage.php">
<div data-role="fieldcontain">
<label for="image" class="required">Select photo</label>
<input type="file" name="image" id="image" />
<p class="error_message" id="img"><p>
</div>
Please help me to fix this. I appreciate your support.