I am trying to refresh listview after sorting names, where data sorting actually works, but list could not refreshed. Here, if i touch listview then shows the sorting data, but when i click sorting button, it does not works only show blank data.
I have done in program, like this
String[] names = new String[] { "Honeycomb", "Donut", "Eclair", "Cupcake", "IceCream Sandwich", "Froyo", "Gingerbread" };
listView = (ListView) findViewById(R.id.listView1);
nameAdapter= new MyBaseAdapter(getApplicationContext(), Arrays.asList(names));
System.out.println(" no sort="+Arrays.asList(names));
bsort.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Collections.sort(Arrays.asList(names));
System.out.println("sort "+Arrays.asList(names));
//nameAdapter= new MyBaseAdapter(getApplicationContext(), Arrays.asList(names));
//listView.setAdapter(nameAdapter);
nameAdapter.notifyDataSetChanged();
}
});
logcat
01-19 15:40:08.971: I/System.out(22343): no sort=[Honeycomb, Donut, Eclair, Cupcake, IceCream Sandwich, Froyo, Gingerbread]
01-19 15:40:09.158: E/Surface(22343): getSlotFromBufferLocked: unknown buffer: 0xb884c720
01-19 15:40:09.159: D/OpenGLRenderer(22343): endAllActiveAnimators on 0xb886bd70 (ListView) with handle 0xb8933368
01-19 15:40:15.002: I/System.out(22343): sort [Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, IceCream Sandwich]
Only problem is I couldnot refresh or update listview, when button bsort is click. When i first time bsort click, sorting data but unable to listview refresh, data are showing non sorted, but when i click listview then sorted data are shown in listview.
Is there is something wrong, with this code.