Sonic wrote:
> Hi all,
>
> I would be VERY greatful if you could help me with this one, its
> literally driving me insane, been trying to do this for 2 days now.
>
> I have a listview, now what I want to do it is, when a position in the
> listview gets clicked on, it changes the icon for that position, to a
> drawable named "ok.png" . Simple,
>
> Below is the method I use to fill the ListView
>
> Java:
>
> private void fillData() {
> // Get all of the notes from the database and create the item
> list
> Cursor c = mDbHelper.fetchAllNotes();
> startManagingCursor(c);
>
> //String[] from = new String[] { DbAdapter.KEY_TITLE };
>
> int[] to = new int[] { R.id.text1 };
>
> // Now create an array adapter and set it to display using our
> row
> SimpleCursorAdapter notes =
> new SimpleCursorAdapter(this, R.layout.row, c, from, to);
>
> setListAdapter(notes);
>
>
>
>
> }
>
>
>
> and the array that is first declared:
>
> Java:
>
> public class QuickList extends ListActivity implements
> View.OnClickListener{
> //declares
> Button add;
> EditText input;
> private DbAdapter mDbHelper;
> private int mNoteNumber = 1;
> private static final int DELETE_ID = Menu.FIRST;
> String[] from = new String[] { DbAdapter.KEY_TITLE };
>
>
>
> I would REALLY appreciate some help with this.
Read:
http://commonsware.com/Android/excerpt.pdf
It shows you how to override getView() on an ArrayAdapter to achieve
your goals. In your case, you will want to override newView() and
bindView(), since you are using a CursorAdapter.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android Development Wiki: http://wiki.andmob.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---