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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:26:43+00:00 2026-05-18T07:26:43+00:00

My app uses a simple SQLite database. Everything works fine I can now present

  • 0

My app uses a simple SQLite database. Everything works fine I can now present a Toast with a chosen row from the return query using:

{
    //etc etc etc...

    c.movetofirst();
    DisplayTitle(c);
}
public void DisplayTitle(Cursor c)
{
    Toast.makeText(main.this, 
            "id: " + c.getString(0) + "\n" +
            "reg: " + c.getString(1) + "\n" +
            "type: " + c.getString(2) + "\n",
            Toast.LENGTH_LONG).show();        
}

I want to prsent all the data in the cursor to the screen using a view but I am not sure how to go about this. Which view should I use? I just wnt a simple looking grid representation which allows me to scroll through each row in the cursor

Thanks in advance.

  • 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-18T07:26:43+00:00Added an answer on May 18, 2026 at 7:26 am

    How can I show ALL rows in the Cursor?

    There are several ways if you are working with a Cursor, for example see the “moveTo” related methods, here’s an example:

    Set<Item> items = new HashSet<Item>(c.getCount());
    if (c.moveToFirst()) {
                do {
                   Item i = new Item(select(c.getString(0), c.getString(1), c.getString(2));
                   set.add(i);
                } while (c.moveToNext());
             }
             if (!c.isClosed()) {
                c.close();
             }
    

    This assumes Item is a data class that has a constructor with three String parameters. Going with your code, id, reg, and type. Usually column 0 will be a numeric ID (not getString, but SQLite uses “manifest typing” so it will sort of dyna-type a String/Long from column 0 — you may want to AUTOINCREMENT and use getLong there though).

    One you have a collection of items, you can do anything you want with them to display them. If you want a scrolling/selectable list, then ListView is an excellent choice. And, you can back it with a CursorAdapter.

    Here’s an example of a ListView that is populated by a CursorAdapter from an open source project: http://code.google.com/p/and-bookworm/source/browse/trunk/src/com/totsp/bookworm/Main.java (see the inner BookCursorAdapter class, it should get you pointed in the right direction).

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

Sidebar

Related Questions

I have a simple app that uses an SQL Express 2005 database. When the
We have an app that uses simple one way binding with a GridView to
To put it simple: a swing app that uses sqlitejdbc as backend. Currently, there's
My app uses a WebRequest at certain points to get pages from itself. This
My WinForms app uses a number of BackgroundWorker objects to retrieve information from a
Currently my app uses just Direct3D9 for graphics, however in the future I' m
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
I have created a setup project in VS2008. My WinForms app uses .NET 2.0,
I have a Cocoa app that uses a WebView to display an HTML interface.
I have a C# app which uses a System.Diagnostics.Process to run another exe. I

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.