Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6360353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:38:18+00:00 2026-05-24T23:38:18+00:00

I am a beginner in both java and android. I am using asynchronous task

  • 0

I am a beginner in both java and android. I am using asynchronous task in my project to fetch some data from a web service, faced some problems in exception handling. I referred this SO question and I am following the pattern suggested by CommonsWare in this link.

I succeeded in catching the exceptions and storing it in an exception variable. I need to compare the caught exception against some standard exceptions in onPostExecute method also I would like to display custom error messages based on that. How can I compare this caught exception against standard exceptions? Any help would be appreciated. Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:38:19+00:00Added an answer on May 24, 2026 at 11:38 pm

    Use Instanceof java keyword. It returns true if object instance is of correct type.

    if(e instanceof SomeStandardException)
    

    Note: instanceof returns true for both exact type and all parent types. So if you use it in a cascading if-elseif then put more concrete types at the top and more generic (parent) types at the bottom.

    Note2: catching generic Exception as proposed in the link is a bad practice – you should only catch exceptions that you want to handle. So instead of saving the exceptin, you should catch a concrete exception via try-catch-catch, save appropriate flag (boolean field maybe) and then act on this flag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a java project written using eclipse ide and I want to run
Good Morning, As a beginner to both Rails and web development, I don't know
I have written a program with both a Advanced Mode and a Beginner Mode
I'm pretty new to Java and am following the Eclipse Total Beginner's Tutorials .
I have been tasked to develop an interactive website using java & mysql: using
I'm trying to send keystrokes from my C# program to a Java application The
I'm a beginner with both Python and RegEx, and I would like to know
hello i'm a beginner java developer and this is one question in a list
I am only a beginner to Android, but I have noticed a number of
I am new to both JAVA and Google App Engine. My Interest in Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.