Hi,
you can't call UI activity like (showing toast or dialog) in doInBackground
method of Asyncro thread. put toast or dialog it in 'onPreExcute()' or
postExcute() methods as per your need.


On Tue, Jul 23, 2013 at 10:19 AM, Seshu <[email protected]> wrote:

> Hi All,
>    In my application am using webservices, the user is sign in the login
> page using facebook so user ll giving his/her credentails, after grant
> access page in facebook came back to main screen and then am calling the
> user request data i.e., firstname, lastname and email id. for this one i
> used async task with progress dialog showing. after completion of
> webservices downloading i am navigating to 2nd screen here 1st screen is
> going to finishing. now in 2nd screen i have logout option, when the user
> selected the logout option the facebook logout and application logout is
> calling. again i am calling first screen by startactivity method. now again
> user wants to login the app using facebook after grant access page, came
> back to first screen here calling webservice again i.e., calling async task
> with progress dialog. on preexecute method i wrote progress dialog. there
> app is crashing and showing this below log.
>
> FATAL EXCEPTION: main
> android.view.WindowManager$BadTokenException: Unable to add window --
> token android.os.BinderProxy@4298f298 is not valid; is your activity
> running?
>     at android.view.ViewRootImpl.setView(ViewRootImpl.java:665)
>     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:328)
>     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:226)
>     at
> android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:151)
>     at android.view.Window$LocalWindowManager.addView(Window.java:547)
>     at android.app.Dialog.show(Dialog.java:277)
>     at android.app.ProgressDialog.show(ProgressDialog.java:116)
>     at android.app.ProgressDialog.show(ProgressDialog.java:99)
>     at android.app.ProgressDialog.show(ProgressDialog.java:94)
>     at
> com.satyaseshu.MainActivity$UserData.onPreExecute(MainActivity.java:209)
>     at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
>     at android.os.AsyncTask.execute(AsyncTask.java:534)
>     at com.satyaseshu.MainActivity.requestUserData(MainActivity.java:191)
>     at
> com.satyaseshu.MainActivity$FbAPIsAuthListener.onAuthSucceed(MainActivity.java:146)
>     at com.satyaseshu.SessionEvents.onLoginSuccess(SessionEvents.java:76)
>     at
> com.satyaseshu.LoginButton$LoginDialogListener.onComplete(LoginButton.java:81)
>     at com.satyaseshu.Facebook$1.onComplete(Facebook.java:310)
>     at
> com.satyaseshu.FbDialog$FbWebViewClient.shouldOverrideUrlLoading(FbDialog.java:131)
>     at
> android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:274)
>     at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:376)
>     at android.os.Handler.dispatchMessage(Handler.java:99)
>     at android.os.Looper.loop(Looper.java:153)
>     at android.app.ActivityThread.main(ActivityThread.java:5000)
>     at java.lang.reflect.Method.invokeNative(Native Method)
>     at java.lang.reflect.Method.invoke(Method.java:511)
>     at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
>     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
>     at dalvik.system.NativeStart.main(Native Method)
>
> if any body knows then please let me know once. i am facing this issue.
> due to this i am unable to show any other popup dialogs and also toast
> message.
>
>
>
> Thanks for all,
> S.Seshu
>
> --
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 

Thanks & Regards
Pankaj Pandey

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to