1

I'm new in android ... so I need help. I have JSON link where I have for example like this

[{"id":"82","percent":"3","image_name":"something.jpg"....

I try some tutorial just for reading text, it was okay. But I have problem how to show in my layout the images from JSON...

Can you help or share some code about this?

1
  • could you provide some code you started writing ? Commented May 13, 2015 at 12:58

2 Answers 2

1

Parse the json string : -

String jsonString = "your json string goes here" ;

JSONObject rootObj = new JSONObject(jsonString);

String link = rootObj.getString("image_name");

You can now use this url/link to convert it into bitmap : -

Bitmap image ;    

 InputStream in = new java.net.URL(link).openStream();

   image = BitmapFactory.decodeStream(in);

    in.close();
Sign up to request clarification or add additional context in comments.

Comments

0

By default you can't disaplay image using web link. However lots of libraries have been created to solve this problem. You can try this one. There's also a list of alternative libraries.

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.