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 6834331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:05:56+00:00 2026-05-26T23:05:56+00:00

I am trying to get column data from sqlLite DB and put that data

  • 0

I am trying to get column data from sqlLite DB and put that data into an array method and then call the method and display the data, for some reason I am only getting the first variable in my column, help please!!!!

-Yes there are more variables in that column

    public String[] getScore01() {

    String[] column1 = new String[] { KEY_NAME };
    Cursor c = ourDatabase.query(DATABASE_TABLE, column1, null, null, null,
            null, null);
    String[] result = {};

    int iName = c.getColumnIndex(KEY_NAME);

    for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {

        String[] result1 = { "" + c.getString(iName) };

        result = result1.clone();
    }
    return result;
}

and here we call the method and get the data set it to an array…

        Database info = new Database(this);

    info.open();
    String[] data = info.getScore01().clone();
    info.close();

setting the textview tvVVTEST to data[0] works, but setting it to data[1] or anything else fails why???

        tvVVTEST.setText("" + data[0]); //works
      //tvVVTEST.setText("" + data[1]); // Does Not Work
  • 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-26T23:05:56+00:00Added an answer on May 26, 2026 at 11:05 pm
    info.open();
    String[] data = info.getScore01().clone();
    info.close();
    

    No need to call like this. Change this to

    info.open();
    String[] data = info.getScore01();
    info.close();
    

    And you have declared result two times.Second make sure that array value will insert on new position everytime.Otherwise it will over write and you will get only one value

    Edited
    changes inside loop to

    where you declare String [] result, Change to String []result=new String[c.getCount()];
     int i=0;
    for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
    
        result1[i] = c.getString(iName);
        i++;
    }
    return result;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get data from a specific column in a database table
I am trying to get a drop-down list to display column data containing countries
I have some XML that stores column information and row data from a table
I'm trying to get the top N records (when ordered by some column X),
I'm trying to get SQL Server to order by a column from a nested
I am trying to capture data from my form and pump it into a
I'm trying to get around pulling all the data from a table, and cycling
i'm trying to get a results set that displays 2 columns from 2 different
What is the best way of handling trying to get data from a DataReader
I am trying to use a Rake task to migrate some legacy data from

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.