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

  • Home
  • SEARCH
  • 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 8418591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:22:39+00:00 2026-06-10T02:22:39+00:00

So I am relatively new to Android and I am trying to parse a

  • 0

So I am relatively new to Android and I am trying to parse a web based CSV document and use two of the values from this document in my app. I have already successfully parsed a CSV document but it only had 1 row.
The document I am trying to parse looks like this:

Light,2012-08-20T11:04:42.407301Z,107
Temperature,2012-08-20T11:04:42.407301Z,24   

I am trying to get the “107” and the “24” values. Can anyone explain how to do this?
This is the code for my current CSV parser class which can successfully parse one line of CSV data.

public class CSVParser {
    static InputStream is = null;
    private String value;

    public String getCSV(String url) {
        // Making HTTP request
        try {
            // defaultHttpClient
            DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpGet httpGet = new HttpGet(url);

            HttpResponse httpResponse = httpClient.execute(httpGet);
            HttpEntity httpEntity = httpResponse.getEntity();
            is = httpEntity.getContent();           

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
        try {
            String line;
            while ((line = reader.readLine()) != null) {
                String[] RowData = line.split(",");
                value = RowData[2];
                // do something with "data" and "value"
            }
        } catch (IOException ex) {
            // handle exception
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                // handle exception
            }
        }
        return value;
    }
}
  • 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-06-10T02:22:40+00:00Added an answer on June 10, 2026 at 2:22 am

    I see you are assigning value = rowData[2], which looks like on the 2 row csv you are only returning the 24 as you assign value each time you read a line. Ie first time it’s assigned 107, then on the next readLine it is overwritten with 24.

    You should make the value variable an array (if you know number of items to get) or list that can hold multiple strings. Then you add to this array or list in each readLine loop.

    So first time it would be (if using value as a List<string>)

      while ((line = reader.readLine()) != null) {
        string[] RowData = line.split(",");
        value.add(RowData[2]);
      }
    

    First time round it will add 107 to the list, then next line it will add 24.

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

Sidebar

Related Questions

I am relatively new to Android, but I am looking to use an interactive
I am relatively new to android. I have two applications A and B. I
I'm relatively new to java and android development so sorry if this is a
I'm relatively new to Android but I just cant google this. I have following
I'm relatively new to android development and I'm trying to make a WebView that
i'm new to android programming and i'm trying to create a relatively big 2D
So I'm making this android application, that needs to read data from user-provided CSV
I'm relatively new to Android development, so bear with me. I'm creating an app
I am relatively new to android development and i am trying to create a
I am relatively a new Android developer and I am not able to understand

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.