I am using a method getBitmap to display images. As I am using this as a method,if it returns bitmap display an image but if it returns null,catch an exception. But if url e
Throw the exceptions from the getBitmap method instead and let the client (Activity) handle the exceptions, in this case either you receive a Bitmap or an exception and can skip the return null bitmap and do the according "default bitmap loading" in the catch blocks, for the exception/error case instead (since this is the null case now).
public Bitmap getBitmap(final String src) throws FileNotFoundException,
OutOfMemoryError, IOException, MalformedURLException {
URL url = new URL(src);
URLConnection connection = url.openConnection();
InputStream input = connection.getInputStream();
return BitmapFactory.decodeStream(input);
}