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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:34:44+00:00 2026-06-07T19:34:44+00:00

So I have been trying to get a ListView to display data from a

  • 0

So I have been trying to get a ListView to display data from a SQLite Database for a few days now, and I still can’t find a solution.

the ListView XML looks like:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >


<Button 
    android:id="@+id/gotoEntry"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="New Entry" />

<ListView 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@android:id/list" >
</ListView>

</LinearLayout>

with the row item looking like this:

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" 
android:textSize="15dp"
android:padding="15dp"
android:id="@+id/thetext"
>
</TextView>

My cursoradapter looks like:

public class ItemAdapter extends CursorAdapter{
private Cursor iCursor;
private Context iContext;
private final LayoutInflater iInflater;


public ItemAdapter(Context context, Cursor c) {
    super(context, c);
    iInflater=LayoutInflater.from(context);
    iContext=context;
}


@Override
public void bindView(View view, Context context, Cursor cursor) {
TextView itemName = (TextView) view.findViewById(R.id.thetext);

    itemName.setText(cursor.getString(cursor.getColumnIndex(db_Setup.KEY_NAME)));
    }
}


@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) throws InflateException {
    final View view = iInflater.inflate(R.layout.single_item, parent, false);
    return view;
}
}

The cursor is being made with this method:

public static Cursor getName() {
    Cursor q = myDatabase.query(DATABASE_TABLE, new
        String[] {db_Setup.KEY_NAME}, null, null, null, null, null);
q.moveToFirst();

return q;
}

and instantiated in the listactivity like so:

Cursor cursor = db_Setup.getName();

I am trying to do this in my ListActivity to bind the listview to the cursor:

ItemAdapter ia = new ItemAdapter(getBaseContext(), cursor);
ia.bindView(findViewById(R.id.thetext), getApplicationContext(), cursor);

There are no errors when I run the app… all there is a button from the XML at the top of this post, and blankness (no listView)…
I have entered some values in the SQLite Database already with something like 14 values or so. Why isn’t anything showing?

  • 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-07T19:34:47+00:00Added an answer on June 7, 2026 at 7:34 pm

    The last line is incorrect. After you create ItemAdapter, simply call ListActivity.setListAdapter(ia). See Displaying query results for more details.

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

Sidebar

Related Questions

I have been trying for too many hours now myself and can't get the
I have been trying to get right solution / answer for my issue, still
I have been trying to get this to work for 12 hrs now and
I'm trying to get contact data once a contact name has been clicked from
I have been trying to get around this error for a day now and
I have been trying to create a ListView which I can sort using drag
I have been trying to get yui-css grid system to make a three column
I have been trying to get nServiceBus to work with Ninject 2.0 as the
I have been trying to get LastBootUpTime using Win32_OperatingSystem class (WMI). HRESULT hr =
I have been trying to get this one section of my UI to immediatly

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.