0

I get url to my Image, and want it make Image; I want use this methods

 URL url = new URL("http://www.digitalphotoartistry.com/rose1.jpg");
java.awt.Image image = java.awt.Toolkit.getDefaultToolkit().getDefaultToolkit().createImage(url); 

or

URL url = new URL("http://www.digitalphotoartistry.com/rose1.jpg");
Image image = ImageIO.read(url);  

but Android Studio can't find ImageIO and java.awt.Toolkit. How can I add them?

1 Answer 1

2

You can get Bitmap from url and then you can use that bitmap further to set image of an ImageView.

URL url = new URL("http://....");
Bitmap  image=BitmapFactory.decodeStream(url.openConnection().getInputStream());
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.