droidin.net wrote:
> I'm trying various ways of Twitter authorization which requires
> roundtrip to the browser.
Why not use their API?
> 1. Execute intent with
> startActivity(new Intent("auth", Uri.parse(authUrl), this,
> Browser.class));
On a side note, since Intent actions are device-global in scope, you may
wish to use something a bit more unique than "auth". I usually namespace
mine (com.commonsware.android.app.MY_ACTION), just to be safe.
> 2. Init browser
> private void initBrowser() {
> this.browser = (WebView) findViewById(R.id.browser);
> this.browser.getSettings().setJavaScriptEnabled(true);
> this.browser.getSettings
> ().setJavaScriptCanOpenWindowsAutomatically(true);
> this.browser.getSettings().setPluginsEnabled(true);
> this.browser.getSettings().setLoadsImagesAutomatically(true);
> this.browser.addJavascriptInterface(this, "MainScreen");
> }
>
> 3. Load url
> this.browser.loadUrl(getIntent().getData().toString());
I suspect you don't want to go down this path.
Let's suppose the form worked. The result will be...a new Browser
window. Links and such from within a WebView do not stay in the WebView
by default.
OK, so you add a WebViewClient and implement shouldOverrideUrlLoading().
Then what?
And, of course, your first problem would be to get the form working.
So, I'll go back to the beginning: why not use their API? I've used
JTwitter in a handful of book examples, and it works swimmingly, or at
least as swimmingly as Twitter's API lets you (it seems to be the first
to fail, before any whale sightings).
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android App Developer Books: http://commonsware.com/books.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---