Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6098885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:12:34+00:00 2026-05-23T13:12:34+00:00

I am pretty new to the world of Android and Java and I am

  • 0

I am pretty new to the world of Android and Java and I am wondering how I get data from the web api here http://www.imdbapi.com/ Into android.
Should I use JSON or XML?
What are the steps? Firstly I want to know how to download the data and then how to parse it to variables.
Any sample code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:12:34+00:00Added an answer on May 23, 2026 at 1:12 pm
    HttpClient httpclient = new DefaultHttpClient();
        // Prepare a request object
        HttpGet httpget = new HttpGet(url); 
        // Execute the request
        HttpResponse response;
    
        JSONArray arr = new JSONArray();
        try {
           response = httpclient.execute(httpget);
    
           HttpEntity entity = response.getEntity();
    
           if (entity != null && response.getStatusLine().getStatusCode() == 200) {
                    // A Simple JSON Response Read
                    InputStream instream = entity.getContent();
                    String result = convertStreamToString(instream);
                    arr=new JSONArray(result);
                    instream.close();
    
                }
            } catch (ClientProtocolException e) {
                // TODO Auto-generated catch block
                Log.e(TAG,e.toString());
            } catch (IOException e) {
                // TODO Auto-generated catch block
                Log.e(TAG,e.toString());
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                Log.e(TAG,e.toString());
            }
    
            return arr;
    
    
    public static String convertStreamToString(InputStream is) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
        StringBuilder sb = new StringBuilder();
    
        String line = null;
        try {
            while ((line = reader.readLine()) != null) {
                sb.append(line + "\n");
            }
        } catch (IOException e) {
            Log.e(TAG + "ERROR",e.toString());
    
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                e.printStackTrace();
                Log.e(TAG + "ERRO",e.toString());
            }
        }
        return sb.toString();
    }
    

    As for parsing, here you go: http://developer.android.com/reference/org/json/package-summary.html

    btw, this was all easily found on google : )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am pretty new to the whole Java and OSGi world and I have
I am new to Java world but I am pretty good at using Flex,
Im pretty new to Java Web Services, but I cant find a good explanation
I'm pretty new to learning about java and android development; so please help me
I'm pretty new to android, Java and sqlite. For my first program I'm creating
i am pretty new to the iOS world and since I'm coming from the
I just started to play with android dev and java+eclipse is pretty new to
Our team is new to both Android and Java development (originally, we came from
I have this exception that I get in my crash reports from Android: java.lang.NoSuchMethodError:
What Android API version would you choose to begin developing a new Java application?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.