I'm trying to retrieve the image from Parse.com. In DataBrowser, if the image file is empty its crashing in code. so I'm handling this error by checking if file!=null.
Its crashing at this line ParseFile file = (ParseFile) ob.get("image"); saying JSONObject cannot be cast to ParseFile.
So How to handle if Parse File is empty??
for (ParseObject ob : result) {
String perf = ob.getString("info");
ParseFile file = (ParseFile) ob.get("image");
if (file != null) {
image_url = file.getUrl();
} else {
/*load some default image url*/
image_url = "www.abc.com/image.png";
}
Picasso.with(getActivity()).load(image_url).into(imageView);
textView.setText(perf);
layoutCards.setVisibility(View.VISIBLE);
}