Reputation: 33
I am building my first Android App to download Images from Instagram API and up till now I am successful to achieve my first major task. Now I want to display full screen image of Thumbnail images received from Insta API but I am struggling to find the method/API Call. A quick clue or suggestion would be really helpful.
JSONParser jsonParser = new JSONParser();
JSONObject jsonObject = jsonParser
.getJSONFromUrlByGet("https://api.instagram.com/v1/users/self/feed?access_token="
+ Token);
JSONArray data = jsonObject.getJSONArray(TAG_DATA);
if (data != null) {
for (int data_i = 0; data_i < data.length(); data_i++) {
JSONObject data_obj = data.getJSONObject(data_i);
JSONObject images_obj = data_obj
.getJSONObject(TAG_IMAGES);
JSONObject thumbnail_obj = images_obj
.getJSONObject(TAG_THUMBNAIL);
String str_url = thumbnail_obj.getString(TAG_URL);
imageThumbList.add(str_url);
Upvotes: 1
Views: 1549
Reputation: 1034
So. It seems that you've got the image URL and now you want to display it somehow. To start with you need something to display the image in.
Use an ImageView like this in your view xml:
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent" />
Then you need to download the image and put it into the ImageView. This can be done in multiple ways but I really recommend using a external library like Picasso for this. It's really simple and looks something like this:
Picasso.with(context).load(str_url).into(imageView);
Good luck!
Upvotes: 1