Issue
I have an html/javascript/css project that i am trying to make an Android application out of. Everything is running fine except for using the tag in the html file. I have an html file with multiple textarea tags, whenever i run the application and try to tap on the textarea in order to enter the input the focus remains in this textarea and i cannot enter any input in any other textarea's afterwards.
Any help ?
P.S. : I am not very experienced in Android development ...
This is my java code :
package com.ai.shiftpuzzle;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
public class ShiftPuzzleXOOMActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView webView = (WebView)findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webView.loadUrl("file:///android_asset/myFiles/main_menu.html");
}
}
Solution
Maybe your issue is related to a documented bug in the Android site : http://code.google.com/p/android/issues/detail?id=7189
There is apparently a by-pass that you can try :
webview.requestFocus(View.FOCUS_DOWN);
webview.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
if (!v.hasFocus()) {
v.requestFocus();
}
break;
}
return false;
}
});
Answered By - Rémi F
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.