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

  • Home
  • SEARCH
  • 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 9125651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:51:12+00:00 2026-06-17T06:51:12+00:00

I have a listfragment that I’m populating with a simplecursoradapter. However, only the first

  • 0

I have a listfragment that I’m populating with a simplecursoradapter. However, only the first column is getting binded to the layout. Here is the code.

public class ContactList extends ListFragment

{
private ActivityDbAdapter mDbHelper;
private Long mRowId=Long.valueOf(1);
Activity mContext;


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) 
{
    mContext=getActivity();
    mDbHelper=new ActivityDbAdapter(mContext);
    mDbHelper.open();
    Cursor activity = mDbHelper.fetchContacts(mRowId);
    if (activity.moveToFirst())
    {


    String[] from = new String[]{ActivityDbAdapter.COLUMN_NAME_CONTACT1 ,
            ActivityDbAdapter.COLUMN_NAME_CONTACT2,ActivityDbAdapter.COLUMN_NAME_CONTACT3,
            ActivityDbAdapter.COLUMN_NAME_CONTACT4, ActivityDbAdapter.COLUMN_NAME_CONTACT5};



    int[] to = new int[]{R.id.contacts};

    SimpleCursorAdapter contacts = 
        new SimpleCursorAdapter(mContext, R.layout.activity_contact_row, activity, from, to);

    setListAdapter(contacts);
    }

    return inflater.inflate(R.layout.activity_contact_list, container, false);

}

}

… So here only Contact1 is showing up in the layout. Or whichever column I have first. From what I understood reading was that I didn’t have to utilize a for loop to correctly bind all of the columns, but it seems that you do? Unless I’m missing something here. Any help would be appreciated.

  • 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-17T06:51:13+00:00Added an answer on June 17, 2026 at 6:51 am

    You have only one item (R.id.contacts) inside your array to; therefore only one view is used/displayed for the data. You need to add the Ids for the other views, too.

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

Sidebar

Related Questions

I have a ListFragment that populates a list using a SimpleCursorAdapter. It is using
i have a ListView on a ListFragment that use SimpleCursorAdapter to generate my list.
I have a ListView in a ListFragment that is populated via a database query.
In my app I have a FragmentActivity that implements ListFragment.OnSelectedListener. The ListFragment uses a
I have an SherlockFragmentActivity that is showing a few tabs. Each tab is ListFragment.
I am new in Android and I have a ListFragment that can successfully show
I have a ListFragment. In onCreateView I inflate a view that has a ListView
I have a layout file containing a listview that I would like to fill
I have a ListFragment that loads stuff from an SQLite Database, and there's a
I have a ListFragment that adds 2 views in the onActivityCreated() method - a

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.