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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:19:45+00:00 2026-06-09T00:19:45+00:00

inHow do i retrieve data from sqlite database from adapter class and insert to

  • 0

inHow do i retrieve data from sqlite database from adapter class and insert to listview???

I’m having difficulty, been coding day & night and googling non-stop but i just don’t understand the links when i open them up. I just start learning android programming recently on my own…

I have attach my code below

public Cursor RetrieveActivityCursor(String NRIC){
    String where = NRIC;

Cursor cursor = _db.query(DATABASE_TABLE,new String[]{ MOBILE_HOUSE_VISIT_ID, ELDERLY_NAME,
        ELDERLY_NRIC, ELDERLY_DATE_TIME, PHYSICAL_HEALTH_STATUS, MENTAL_HEALTH_STATUS} , where, null, null, null, null);
//Cursor cursor = _db.query(DATABASE_TABLE, new String[] { ELDERLY_NAME,
        //ELDERLY_NRIC, DATE_TIME, PHYSICAL_HEALTH_STATUS, MENTAL_HEALTH_STATUS }, null, null, null, null, null);
return cursor;
}

this code is from my adapter class and have to pass in nric and return datetime value inserted into listview

im not too sure how to code to call this method.

  • 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-09T00:19:46+00:00Added an answer on June 9, 2026 at 12:19 am

    If you are extending the SqliteOpenHelper for the database handling and using another class to which extends Activity, in which you have your ListView then, in your Activity class make the object of your class like,

     YourDBClass helperDB;
     helperDB = new HelperDB(YourActivityClass.this);
    

    And to retrive the data from the Database.

    Make Cursor reference like,

     Cursor cursor;
    

    And then, do like this,

     cursor = helperDB.RetrieveActivityCursor(NRIC);
     cursor.moveToFirst();
     while(!cursor.isAfterLast()) {
        // here you have to collect the data in the collection object.
        cursor.moveToNext();
     }
     cursor.close();
    

    That’s it! And you have done with retriving data from database

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

Sidebar

Related Questions

I need help in how to retrieve data from SQLite database and put into
As described in How do i retrieve data from a JVM renderized into a
I am working on a class library that retrieves information from a third-party web
I would like to know how to retrieve more than 200 tweets from a
I have been trying the code given in How to use YQL to retrieve
I am currently trying to insert data into a table called customer_quote , this
I have an interesting issue with inserting rows of data into a dataview. I
I am interested in how you would sort the following data most effectively with
In PHP 5.2.x, mySQL 5.x Im having a bit of an issue wrapping my
I need help in how to remove the last comma from this looped var,

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.