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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:49:28+00:00 2026-06-12T13:49:28+00:00

Here is my fetch IDs function in DBAdapter class: I want to fetch all

  • 0

Here is my fetch IDs function in DBAdapter class:
I want to fetch all the IDs and display the list in a toast message, cant understand where I am going wrong.

   public Cursor fetchAllIDs() {

         return mDb.query(DATABASE_TABLE0, new String[] {IDno1}, null, null, null, null,   null);
   }

Here is my function which I call on a button click and I want my toast to be filled with all IDs.

   private void fillData() {
       // Get all of the IDs from the database
          Cursor c = DBHelper.fetchAllIDs();
          startManagingCursor(c);

          String[] from = new String[] {DBAdapter.IDno1 };
          Toast.makeText(getApplicationContext(), ""+from, Toast.LENGTH_LONG).show();
}
  • 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-12T13:49:31+00:00Added an answer on June 12, 2026 at 1:49 pm

    First, you are returning a Cursor but then you never use the information in this Cursor.

    Second, you cannot display a String[] as a string anyway. You’d have to loop through the String[] and display the values one by one.

    You want something like this:

    private void fillData() {
        Cursor c = DBHelper.fetchAllIDs();
        List<String> idList = new ArrayList<String>();
        if (c.moveToFirst()) {
            do {
                idList.add(c.getString(c.getColumnIndexOrThrow(IDno1)));
                Toast.makeText(getApplicationContext(), "" + idList.get(idList.size()-1), Toast.LENGTH_LONG).show();
            } while (c.moveToNext());
        }
    }
    

    Edit: Fixed getLong() to getString().

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

Sidebar

Related Questions

Here is my code @Entity class Parent extends Person { @OneToMany(cascade = CascadeType.ALL, fetch
I have a list of IDs in a String, and want to use Hibernate
I have a simple question - basically I want to fetch all ActiveRecords of
<?php include 'includes/config.php'; function do_curl($start_index, $stop_index) { // Do query here to get all
Here is source code: @OneToOne(fetch = FetchType.LAZY) @Cascade({SAVE_UPDATE, EVICT, DELETE}) @JoinColumn(name = A_ID, nullable
Here's what I need to fetch: - posts that have comments - number of
here is my code i am using to fetch mysql result from 4 different
Android newbie here. I'm using this tutorial to show some rows that I fetch
I have two tables as shown here . I am trying to fetch name
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }

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.