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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---