How can I put an image from an url into an ImageView?
i dont want to use any library, id rather stick to the plain old way, i like it. dont judge me. like i said before i got this working but oddly its not anymore
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView damnit = (ImageView)findViewById(R.id.imageview);
try {
URL url = new URL("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png");
InputStream in = url.openStream();
Bitmap bitt = BitmapFactory.decodeStream(in);
damnit.setImageBitmap(bitt);
} catch (Exception e) {
e.printStackTrace();
}
}
edit!
Im such an idiot, sorry for taking your time guys... I have to have a runOnUI Thread, and inside have the "damnit.setImageBitmap(bitt);"