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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:56:26+00:00 2026-05-30T03:56:26+00:00

Ive been struggling for a while with my rather simple app. This is my

  • 0

Ive been struggling for a while with my rather simple app.
This is my onCreate in my listactivity class:

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    DB db = new DB(this);
    db.open();
    cur = db.getData(); //cursor with all data from an SQLite db

    String[] from = new String[] { DB.KEY_FIRSTNAME,
            DB.KEY_LASTNAME, DB.KEY_BDATE};
    int[] to = new int[] { NOT SURE WHAT TO PUT HERE };
    startManagingCursor(cur);
    setListAdapter(new SimpleCursorAdapter(this, 
    android.R.layout.simple_list_item_1, cur, from, to));

    db.close();

    }

The getData() method returns a cursor from an sqlite database. the int[] used by the adapter defined over is where I think the problem lies, but I have no idea how to solve it. The list I get out is either blank. Only lines resembling the number of entries in the database or only 1 of the columns. I have tried int[] {android.R.id.text1, android.R.id.text1, android.R.id.text1, android.R.id.text1} and fewer entries, and text2 and Ive now tried to just make a textview and call that, but then it goes completely blank again.

I hope you can help me wrap my head around this. Thanks!

  • 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-30T03:56:27+00:00Added an answer on May 30, 2026 at 3:56 am

    Your to variable stores the R.id’s of where you want to map your data to. For example, if the layout (android.R.layout.simple_list_item_1) has three TextViews in it, named fName, lName and bDate you would place those in the int array and it will map the data in the from fields to the on screen layout components in the to fields.

    int[] to = new int[] {R.id.fName, R.id.lName, R.id.bDate};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ive been struggling with this for a while. its taking over 12 seconds and
I've been struggling for a while with this one; I'll try to explain it
I've been struggling with this for quite a while My application contains a list
I've been struggling with this issue for a little while now. Found several posts
I've been struggling with this for a while now, and this code crashes with,
This is a problem I've been struggling to solve for a while. I need
I've been struggling for quite a while to get this feature working: I want
I've been struggling with this issue for a while now, and none of the
I've been struggling with this issue for a while now. Maybe you can help.
I've been struggling with this for a while now and I don't know what

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.