I try WebView class.
donwload
apk.
set setWebViewClient for no intent WEB BROWSER.
WebView w = (WebView)findViewById(R.id.webView1);
w.setWebViewClient(new WebViewClient());
enable javascript.
w.getSettings().setJavaScriptEnabled(true);
add Zoom Control
w.getSettings().setBuiltInZoomControls(true);
If app finish to load web page, call callback. I register callback.
w.setWebViewClient(new webclient());
and callback function by WebViewClient. If call onPageFinish, app update url text and app focus web page.
public class webclient extends WebViewClient {
@Override
public void onPageFinished(WebView view, String url) {
setProgressBarIndeterminateVisibility(false);
WebView w = (WebView)findViewById(R.id.webView1);
TextView t = (TextView)findViewById(R.id.editText1);
String u = w.getUrl();
t.setText(u);
w.requestFocus();
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
setProgressBarIndeterminateVisibility(true);
}
}
If user push W button, app hide ime.
Button b = (Button)findViewById(R.id.button1);
b.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText e = (EditText)findViewById(R.id.editText1);
if (e.isFocused()) {
WebView w = (WebView)findViewById(R.id.webView1);
mI.hideSoftInputFromWindow(w.getWindowToken(), 0);
If user push W button, app jump url inputted by user.
If input text is not ".", app think text is search word.
If input text is not "http://", app add "http://" to url.
TextView t = (TextView)findViewById(R.id.editText1);
if (!t.getText().toString().matches(".")){
w.loadUrl("http://www.google.co.jp/search?q=" + t.getText().toString());
} else if (!t.getText().toString().startsWith("http://")) {
w.loadUrl("http://" + t.getText().toString());
} else {
w.loadUrl(t.getText().toString());
}
If user input url text, app foucs text all.
EditText e = (EditText)findViewById(R.id.editText1);
e.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus == true) {
EditText e = (EditText)findViewById(R.id.editText1);
e.selectAll();
}
}
});
If user push back button, app go back's web page.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
WebView w = (WebView)findViewById(R.id.webView1);
w.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
source code is
here.
Please suggest your android issue by twitter or mail, I would try to clear up your issue.