tags:

views:

509

answers:

2

Hi guys,

I am loading a URL whose datatype is String in a WebView. Using something like:

webview.loadUrl(string_variable);

but it is automatically redirected to the browser.

I got this in my LOGCAT,

02-13 14:11:08.586: INFO/ActivityManager(5Cool: Displayed activity com.example.brown/.Bru_Press_MostRecent_ArticleView: 2583 ms (total 2583 ms)
02-13 14:11:09.376: INFO/ActivityManager(5Cool: Starting activity: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=http://mobile.twitter.com/brownuniversity/statuses/8681812931 cmp=com.android.browser/.BrowserActivity (has extras) }
02-13 14:11:09.506: INFO/ActivityManager(5Cool: Start proc com.android.browser for activity com.android.browser/.BrowserActivity: pid=285 uid=10014 gids={3003, 1015}
+1  A: 

Does the same thing happen with a different URL? I'm wondering if mobile.twitter.com has a redirect which is causing the Browser to be launched.

Dave Webb
hey how to rectify that? i want to load only in my webview..actually i m passing the url value : http://twitter.com/brownuniversity/statuses/8963488831but its automatically loads. what can i do mate?
Praveen Chandrasekaran
i am getting this problem in twitter's url only man.. but how can i solve it?
Praveen Chandrasekaran
This is poorly qualify as answer. Should probably be just a comment
DroidIn.net
+3  A: 

You can remedy this by overriding your WebView's WebViewClient. All it takes is something like this:

    webView = (WebView) findViewById(R.id.webView);
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
           return super.shouldOverrideUrlLoading(view, url);
        }
    });

Just be aware that WebView is more limited than full blown browser

DroidIn.net
yep i founded it long time ago...... anyway thanks for your commitment.
Praveen Chandrasekaran
n.p. I was dealing with the same problem. BTW it helps to revisit your own questions and add solution if you found one. I try to do that when I won't get a clear answer and later find answer somewhere else
DroidIn.net