0

I fetch my json object to the function but I have unhandled exception error, is anyone knows about this problem, appreciated sample code!

Thanks!

//Here is the error, when I want to fetch the object = jsonObj //acctually the error is in the code I cann't run it, it's a red line from //TestValidator.validateDateWithCriteria(testCriteria, jsonObj);

   return TestValidator.TestWithCriteria(testCriteria, jsonObj);
}
  • Please upload the error log with question. – Lucifer Jun 26 '14 at 02:59
  • post the LogCat of the exception – panini Jun 26 '14 at 03:02
  • @Kedarnath Thanks for the comment error is on the code I cannot run it, I have redline for all after return DateValidator.validateDateWithCriteria(validationCriteria, jsonObj); – Anna daadson Jun 26 '14 at 03:31
  • @panini Thanks for the comment error is on the code I cannot run it, I have redline for all after return DateValidator.validateDateWithCriteria(validationCriteria, jsonObj); – Anna daadson Jun 26 '14 at 03:31
  • possible duplicate of [Unfortunately MyApp has stopped. How can I solve this?](http://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this) – Code-Apprentice Jun 26 '14 at 03:50
  • If you are using Eclipse, you should open the Problems View and copy and paste the error message here. – Code-Apprentice Jun 26 '14 at 03:51

1 Answers1

2

In your definition of DateValidator#validateDateWithCriteria() you have said that it throws an Exception.

However, when you call the method, you aren't putting it in a try/catch block. Because you have said you will throw an Exception, you must attempt to catch this potential Exception whenever you call the method. for example:

try{
     return DateValidator.validateDateWithCriteria(validationCriteria, jsonObj);
}catch(Exception ex){
    Log.e("Your Tag", "DateValidator", ex);
    return null;
}
panini
  • 2,026
  • 19
  • 21