Help with Populating List with ListAdapter

This is a discussion on Help with Populating List with ListAdapter within the Android App Developers forums, part of the Droid Apps category; I am having a bit of a problem with populating a list from a RingtoneManager to a new ListActivity. The list populates with the correct ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Help with Populating List with ListAdapter

  1. Junior Droid
    r2sjoblom's Avatar
    Member #
    173795
    Join Date
    Feb 2011
    Posts
    10
    Phone
    droid x
    #1

    Help with Populating List with ListAdapter

    I am having a bit of a problem with populating a list from a RingtoneManager to a new ListActivity. The list populates with the correct number of items in the directory but doesn't show the titles or any text. Using the Log.d(); I can see the items are being pulled properly but not displaying. Any guidance would be appreciated.

    mRingtoneManager2 = new RingtoneManager(this); //adds ringtonemanager
    mRingtoneManager2.setType(RingtoneManager.TYPE_RINGTONE); //sets the type to ringtones
    mRingtoneManager2.setIncludeDrm(true); //get list of ringtones to include DRM
    mCursor2 = mRingtoneManager2.getCursor(); //appends my cursor to the ringtonemanager
    startManagingCursor
    mCursor2); //starts the cursor query
    //prints output for diagnostics
    String test =
    mCursor2.getString(mCursor2.getColumnIndexOrThrow(RingtoneManager.EXTRA_RINGTONE_TITLE));
    Log.d(
    null, test, null);
    String[] from = {RingtoneManager.
    EXTRA_RINGTONE_TITLE}; // get the list items for the listadapter
    int[] to = newint[] {R.id.item1}; //sets the items from above string to listview
    //new listadapter, created to use android checked template
    SimpleCursorAdapter listadapter =
    new SimpleCursorAdapter(this, android.R.layout.simple_list_item_checked, mCursor2, from, to );
    setListAdapter(listadapter);
  2. Sponsor
    DF Advertising
    Join Date
    Nov 2008
    Location
    DroidForums.net
     
     
     
     
  3. Junior Droid
    r2sjoblom's Avatar
    Member #
    173795
    Join Date
    Feb 2011
    Posts
    10
    Phone
    droid x
    #2
    Got it! Im posting what I needed to help anyone else.

    mRingtoneManager2 = new RingtoneManager(this); //adds ringtonemanager
    mRingtoneManager2.setType(RingtoneManager.TYPE_RINGTONE); //sets the type to ringtones
    mRingtoneManager2.setIncludeDrm(true); //get list of ringtones to include DRM
    mCursor2 = mRingtoneManager2.getCursor(); //appends my cursor to the ringtonemanager
    startManagingCursor(
    mCursor2); //starts the cursor query
    //prints output for diagnostics
    String test =
    mCursor2.getString(mCursor2.getColumnIndexOrThrow(RingtoneManager.EXTRA_RINGTONE_TITLE));Log.d(null, test, null);String[] from = {mCursor2.getColumnName(RingtoneManager.TITLE_COLUMN_INDEX), mCursor2.getColumnName(RingtoneManager.URI_COLUMN_INDEX)}; // get the list items for the listadapter could be TITLE or URI
    int[] to = {android.R.id.text1, android.R.id.text2}; //sets the items from above string to listview
    //new listadapter, created to use android checked template
    SimpleCursorAdapter listadapter =
    new SimpleCursorAdapter(this, android.R.layout.simple_list_item_2, mCursor2, from, to );setListAdapter(listadapter);//prints output for diagnostics
    String test2 = listadapter.toString();Log.d(
    null, test2, null);//adds listview so I can get data from it
    ListView lv = getListView();

Sponsors

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Similar Threads

  1. App list
    By erict in forum Droid Applications
    Replies: 6
    Last Post: 11-04-2010, 10:35 AM
  2. Any suggestions for a good shopping list/to do list combo app?
    By EVILOLIVE in forum Droid Applications
    Replies: 9
    Last Post: 06-02-2010, 01:10 PM
  3. I cal to do list
    By fantom557 in forum Droid General Discussions
    Replies: 1
    Last Post: 05-06-2010, 09:37 PM
  4. Issue with contacts populating
    By HarleyDad09 in forum Tech Issues, Bug Reports & Suggestions
    Replies: 5
    Last Post: 01-05-2010, 01:15 PM
  5. changing to new droid and apps not populating
    By tennvol in forum Droid General Discussions
    Replies: 10
    Last Post: 12-29-2009, 12:15 PM

Search tags for this page

android listadapter

,

android listadapter example coloms

,

android new listadapter problem

,

android populating a list

,

getcolumnindexorthrow(ringtonemanager.extra ringtone title)

,

listadapter android

,

listadapter thread

,

populate list adapter using thread

Click on a term to search our site for related topics.

Tags for this Thread