android - WebView.loadUrl(url) does nothing -
i wrote simple twitter app android learn ropes of twitter api , oauth.
the app's main activity asks username follow. calls activity handles oauth & twitter api calls. redirects user authorization page, returns app after user finishes.
it used work fine, reason when call webview.loadurl(authorizationurl), nothing happens. never changed affect webview stuff though... here's code:
@override public void onresume() { super.onresume(); try { if(weneedcredentials()) { obtaincredentials(); } follow(musername); } catch (oauthexception oae) { // omitted } } private boolean weneedcredentials() { // assume method returns true } private void obtaincredentials() { final token requesttoken = moauthservice.getrequesttoken(); string authurl = moauthservice.getauthorizationurl(requesttoken); // verified authurl correct url (and != null) final webview oauthview = (webview) findviewbyid(r.id.oauthview); oauthview.setwebviewclient(new webviewclient() { @override public boolean shouldoverrideurlloading(webview view, string url) { if(somecondition) { oauthview.setvisibility(view.gone); dootherstuff(); return true; } return super.shouldoverrideurlloading(view, url); } }); oauthview.getsettings().setjavascriptenabled(true); oauthview.loadurl(authurl); }
here's layout xml file:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <webview android:id="@+id/oauthview" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </linearlayout>
and included proper internet permissions in manifest.
a webviewcorethread running life of app, , webviewworkerthread pops in later, no webview ever comes (not white screen). app never blocks either. continues running if loadurl() line commented out.
i've tested on phone (droid x2) emulator, both same results. appreciated.
thanks in advance!
it continues running if loadurl() line commented out.
it "continue running if loadurl()
line commented out". loadurl()
asynchronous , not block.
off cuff, either:
weneedcredentials()
returningfalse
, orfollow()
replacing ui, or- twitter doing redirect, ,
somecondition
true
, makingwebview
gone
right away - there issues url loading
Comments
Post a Comment