Search code examples
javaandroidapiimgurmobile-development

How to fetch images from Imgur API in Java


Hello I'm new in Java Android development and i was following a tutorial on how to fetch data from Imgur API. After I finished the tutorial i tired the app but i don't see any images or data on the emulator bc i think that i did some mistake in my code. If anyone can give me a sample how to implement the code or example. Thank you in advance

Tutorial -> https://progur.com/2016/11/create-imgur-client-android.html

My Code -> https://www.codepile.net/pile/A6bkN9eW


Solution

  • I tried running your code exactly the same way except the url in your request object and I was able to fetch the images from Imgur API. I used the url given in the tutorial as below:

    Request request = new Request.Builder()
               .url("https://api.imgur.com/3/gallery/user/rising/0.json")
                .header("Authorization","Client-ID 4ec810250ea92fb")
                .header("User-Agent","Epicture")
                .build();
    

    You might have used the wrong API. Hope it helps.