Add an instance-variable to your own AsyncTask subclass that will hold
the result of your background processing. When you get an exception,
store the exception (or some other error-string/code) in this
variable.

When onPostExecute is called, see if this instance-variable is set to
some error. If so, show an error message.

On Aug 18, 10:02 am, Atif Gulzar <[email protected]> wrote:
> then how can I handle exceptions.
>
> --
> Best Regards,
> Atif Gulzar
>
> I ◘◘◘◘ Unicode, ɹɐzlnƃ ɟıʇɐ
>
>
>
> On Tue, Aug 18, 2009 at 7:56 PM, Andrei <[email protected]> wrote:
>
> > You can not do any UI activity from background thread
> > See here examples
> >http://android-developers.blogspot.com/2009/05/painless-threading.html
>
> > On Aug 18, 9:45 am, Atif Gulzar <[email protected]> wrote:
> > > Hi all,
>
> > > AsyncTask blocks exceptions?
>
> > > Please see the below code. My "getOffersStatus" function catches certain
> > > exceptions and show them in a AlertDialog. But instead of getting my
> > custom
> > > exceptions message I get default error dialog "The application ... has
> > > stopped unexpectdly. Please try again".
>
> > > Any thoughts ?
>
> > > protected ArrayList<TJCOffersStatus> doInBackground(Void... nothing)
> > >     {
> > >         return tj.getOffersStatus(config, "test1234");
>
> > >     }
>
> > > --
> > > Best Regards,
> > > Atif Gulzar
>
> > > I ◘◘◘◘ Unicode, ɹɐzlnƃ ɟıʇɐ- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to