Try using Cursor instead of SQLiteCursor.

On Apr 27, 11:11 pm, Kent Yip <yes...@gmail.com> wrote:
> Thx Glen the textview works great, but the SQLiteCursor doesn't work.
>
> On Mon, Apr 27, 2009 at 10:47 PM, Glen Humphrey <glendon.humphr...@gmail.com
>
> > wrote:
>
> > You could also do something like this in your onListItemClick.
>
> >    SQLiteCursor cursor = (SQLiteCursor) l.getItemAtPosition
> > (position);
> >    String title = cursor.getString(cursor.getColumnIndexOrThrow
> > (RingtoneManager.EXTRA_RINGTONE_TITLE));
>
> > On Apr 27, 10:26 pm, Glen Humphrey <glendon.humphr...@gmail.com>
> > wrote:
> > > Try something like this in your onListItemClick.
>
> > >     TextView textView = (TextView) v.findViewById(R.id.title);
> > >     String text = textView.getText().toString();
>
> > > On Apr 27, 8:14 pm, Kent Yip <yes...@gmail.com> wrote:
>
> > > > i have a method that fill the list with items
>
> > > > // Depending on param, this method will display the list
> > > >     public void fillData( RingtoneManager rm, int type ) {
> > > >         // Set all type of sounds; notification, ringtone, alarm
> > > >         rm.setType( type );
> > > >         c = rm.getCursor();
>
> > > >         startManagingCursor( c );
>
> > > >         String[] from = new String[] {
> > RingtoneManager.EXTRA_RINGTONE_TITLE};
>
> > > >         int[] to = new int[] { R.id.title };
>
> > > >         SimpleCursorAdapter rt =
> > > >             new SimpleCursorAdapter( this, R.layout.ringtones_row, c,
> > from,
> > > > to );
> > > >         setListAdapter( rt );
>
> > > >     }// end fillData() method
>
> > > > when i select an item i want to be able to display the ringtone's title
> > or
> > > > play the ringtone but i am having trouble doing so.
>
> > > > this get call when item is clicked
>
> > > > // Plays ringtone when cliking on the list item
> > > >     @Override
> > > >     public void onListItemClick(ListView l, View v, int position, long
> > id) {
> > > >         super.onListItemClick(l, v, position, id);
>
> > > >         // play the ringtone selected or get text/string from listview
>
> > > >         Toast.makeText( this, text, Toast.LENGTH_SHORT ).show();
>
> > > >     }// end onListItemClick() method
>
> > > > i tried this: l.getItemAtPosition( position )
>
> > > > that return an object data. but i have no clues as to what i could use
> > to
> > > > extract string title from it.
>
> > > > I use toString() to get and idea what i am accessing and it's a
> > > > com.android.internal.sortcur...@12345678
>
> > > > please help, much appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to