Sunday, January 30, 2011

[android-developers] Couldn't refresh list

Hi,

could anyone provide quick hint, because I just cannot get it..


I am adding new values to my ArrayList and putting those values on
ListActivity.

code:

bSetNote.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
saveNote(etNote.getText().toString());
notes = getNotes();
ia.notifyDataSetChanged();
}

});


Iconic adapter is like this:

class IconicAdapter extends ArrayAdapter {
Activity context;

IconicAdapter(Activity context) {
super(context, R.layout.row, notes);

this.context = context;
}

public View getView(int position, View convertView, ViewGroup
parent) {

View row = null;

LayoutInflater inflater = context.getLayoutInflater();
row = inflater.inflate(R.layout.note_row, null);

TextView tvNote = (TextView) row.findViewById(R.id.tvNote);

tvNote.setText(notes.get(position).toString());


But on notifyDataSetChanged in onClickListener list doesn't get
updated. But after going from activity and back to activitiy list is
updated.

What I am missing.

Tnx in advance.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment