I am loading bitmap from a twitter feed. I am using below code
private class getBitmapFromLink extends AsyncTask<String, Void, Bitmap> {
    private ImageView imgView;
    public getBitmapFromLink(ImageView imgView) {
        this.imgView = imgView;
    }
    @Override
    protected Bitmap doInBackground(String... params) {
        Bitmap myBitmap;
        try {
            URL url = new URL(params[0]);
            HttpURLConnection connection = (HttpURLConnection) url
                    .openConnection();
            connection.setDoInput(true);
            connection.connect();
            InputStream input = connection.getInputStream();
            myBitmap = BitmapFactory.decodeStream(input);
            return myBitmap;
        } catch (IOException e) {
            Log.v("BITMAP", e.getMessage());
            return null;
        } catch (Exception e) {
            Log.v("BITMAP", e.getMessage());
            return null;
        }
    }
    @Override
    protected void onPostExecute(Bitmap result) {
        imgView.setImageBitmap(result);
        imgView.invalidate();
    }
}
When I debug myBitmap = BitmapFactory.decodeStream(input); line it directly come to catch block and on return null line. While debugging I tried printing error message on logs but it does not execute that line and directly come to return statement.
Thanks in Advance
 
    