Skip to content Skip to sidebar Skip to footer

Null Pointer Exception When Getting Image From Url To Put In Imageview

I'm getting my image through an URL and trying to set that to my imageView. But I'm getting a Null Pointer Exception. It is not even entering my asynchtask. Is there something I'm

Solution 1:

ImageView thumbnail = (ImageView) findViewById(R.id.btnThumbnail);

You need to get your image after inflating the layout, otherwise findViewById will returns null :

ImageView thumbnail; 

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.detail);
    thumbnail = (ImageView) findViewById(R.id.btnThumbnail)

Post a Comment for "Null Pointer Exception When Getting Image From Url To Put In Imageview"