singleCursorHandlerTouchEvent -getEditableSupport FASLE错误 [英] singleCursorHandlerTouchEvent -getEditableSupport FASLE bug
问题描述
我在我的应用程序中的web视图。有一个浏览(上传文件)按钮,在一个网页。当我测试在HTC的应用程序(安卓4.0.3),它是工作,但在银河S3(安卓4.1.1),它不工作。
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。
"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);
}
});
这是我的onActivityResult函数
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);
}
}
在我的jQuery Mobile的网页我有一个简单的形式:
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>
请帮我解决这个问题。我AP preciate您的支持。
Please help me to fix this. I appreciate your support.
推荐答案
我有同样的问题,(只似乎是在Android 2.xx的)对我来说是web视图不接收焦点问题。
I just had this same issue, and the problem (only seems to be on Android 2.x.x) for me was that the WebView does not receive focus.
您可以做到这一点,要求专注于你的WebView处接收到触摸时:
You can do this to request focus on your WebView when a touch is received:
webView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN && !view.hasFocus()) {
view.requestFocus();
}
return false;
}
});
请参阅的Android的WebView - 内容不可编辑
这篇关于singleCursorHandlerTouchEvent -getEditableSupport FASLE错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!