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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:31:54+00:00 2026-05-23T05:31:54+00:00

I am learning Android development. I have an IOU table that has name and

  • 0

I am learning Android development. I have an IOU table that has name and amount. So, after multiple entries into the DB table, you would have something like this:

name1 50
name2 25
name1 10
name3 60

… …

My question is, what is the best way to pull the entries from the table and sort them as an array in an Adroid application.

For example, Array1[] name1 = [50, 10, …] where 50 and 10 are the amount associated with name1 in the DB.

I cannot just use SELECT * FROM table WHERE name = name1 because the names will change and it will be increasing. I heard from this SO question:
How to store arrays in a database?
that dynamically generating table is not a good idea.

  • 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-23T05:31:54+00:00Added an answer on May 23, 2026 at 5:31 am

    I think you want a query like this:

    SELECT * FROM table ORDER BY name
    

    or

    SELECT * FROM table ORDER BY amount
    

    That is, you don’t need a WHERE clause if you want all of the rows. And the ORDER BY clause can do the sorting for you.

    However: Are you sure that you need to pull all the data into an array — especially if the database can do the sorting that you need? One alternative would be to open a cursor, and then do whatever processing you need one row at a time.

    EDIT: Another example (based on your comment; I have not tested this):

    SELECT name, SUM(amount) FROM table GROUP BY name ORDER BY name
    

    will give you one row for each unique name in the database, with the sum of each amount associated with that user. For the example you posted above, this would result in the following rows:

    name1 60  // The sum of the two rows that have name="name1"
    name2 25
    name3 60
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an Android app that has multiple screens the user will
I have starting learning Java and android application development side-by-side. Currently, I a String-array
I have just finished learning application development on android platform, as In matter of
I'm planning to start self-learning of Android development. What would you guys recommend as
I have recently started learning Android development. In the android-sdk/tools folder, there should be
I have been slowing learning and building my first android app. I'm VERY new
I'm learning android development and I'm doing a minesweeper. So I use a tableLayout
I'm familiar with C++ but never used Java. I've just started learning Android development.
I've been learning android development (in Eclipse) the past week. I'm following online courses
I'm learning Android development using Pro Android Web Apps (Apress, Auths: Damon Oehlman &

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.