Skip to content Skip to sidebar Skip to footer

Webview Twitter Login Window On Ui Thread

I'm attempting to allow a user to login via a WebView within a DialogPreference my application and this work fine, but I seem to be stuck on how to do this properly. If I do this a

Solution 1:

Yes, using the ScrictMode Policy is a hack, and a terrible one as stated here and here

You have two ways to solve this:

1- Return the authURL from the onPostExecute() method of your MyLoginTask. Simply define a setter in the object that calls the MyLoginTask, and have onPostExecute() assign the result to it.

2- Pass a reference to your webview to the MyLoginTask, and have it load the url in the onPostExecute(). Because onPostExecute() will always run in the UI thread, you will get rid of the warning.

In any case, do check out this post by the Android developers about 'Painless Threading'; you will certainly find it helpful: http://android-developers.blogspot.ca/2009/05/painless-threading.html

Post a Comment for "Webview Twitter Login Window On Ui Thread"