I add a webview in my fragment.The page loads beautifully, and I'm able to select the textboxes, but typing in them will not work.I take help from this link.. Why is Android WebView refusing user input?
But it also did not help me.My code is..
public class CityTouchFinal extends Fragment{
View v;
private ProgressDialog pd;
static WebView webView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// getActivity().requestWindowFeature(Window.FEATURE_NO_TITLE);
v = inflater.inflate(R.layout.webload, null);
webView = (WebView) v.findViewById(R.id.load);
ConnectionDetector connectionDetector = new ConnectionDetector(
getActivity());
if (connectionDetector.isConnectingToInternet() == true)
{
pd = new ProgressDialog(getActivity());
pd = ProgressDialog.show(getActivity(), "Url", "loading");
pd.show();
}
else {
Toast.makeText(getActivity(), "Check Internet Connrction",
Toast.LENGTH_SHORT).show();
FragmentTabHost tabHost = Moctabactivty.self.mTabHost;
tabHost.setCurrentTab(0);
}
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setUseWideViewPort(true);
webView.loadUrl("http://www.google.com");
/// webView.loadUrl("https://ibank.thecitybank.com/ilogin.php");
webView.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);
webView.setFocusable(true);
webView.setClickable(true);
webView.setHapticFeedbackEnabled(true);
webView.setFocusableInTouchMode(true);
webView.requestFocus(View.FOCUS_DOWN);
webView.setWebViewClient(new MyWebViewClient());
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;
}
});
return v;
}
private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
if (!pd.isShowing()) {
pd.show();
}
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
System.out.println("on finish");
if (pd.isShowing()) {
pd.dismiss();
}
}
}
}