Issue
I m beginner in android. i want to open twitter url in webview. i have a twitter url(http://twitter.com/..). i try to this code but can not open in webview.
code:
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
activity.setTitle(" Loading...");
activity.setProgress(progress * 100);
if(progress == 100){
activity.setTitle(R.string.app_name);
//view.canGoBack();
}
}
});
webView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url){
view.loadUrl(url);
view.canGoBack();
return true;
}
});
//The URL that webview is loading
webView.loadUrl(uri);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(event.getAction() == KeyEvent.ACTION_DOWN){
switch(keyCode)
{
case KeyEvent.KEYCODE_BACK:
if(webView.canGoBack() == true){
webView.goBack();
}else{
finish();
}
return true;
}
}
return super.onKeyDown(keyCode, event);
}
help me.....
Solution
I got solution in my Question
webView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17");
Answered By - Dugs
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.