Yet again that java.lang.IllegalStateException occurs with "The content of the adapter has changed but ListView did not receive a notification".
Looking on the platform source, I see the following:
This is thrown in the ListView.layoutChildren() when adapter's getCount() is not equal to AdapterView<>.mItemCount.
AdapterDataSetObserver in an inner class of AdapterView<>, it assigns the AdapterView<>.mItemCount in own method onChanged() taking the value from the adapter (AdapterView.java:778).
An AdapterDataSetObserver instance is AbsListView.mDataSetObserver, created in ListView.setAdapter()
Where that onChanged() called from? It need to be called before the adapter starts reportn the new count number. I see it's called only on some header/footer adds and removes in the ListView class.
mDataSetObservable is created in BaseAdapter and notifyDataSetChanged() passed to it.
Assuming those objects are related, I just need to change the data in adapter in the UI thread on completion and then call notifyDataSetChanged()
Showing posts with label sdk. Show all posts
Showing posts with label sdk. Show all posts
Sunday, April 4, 2010
Wednesday, February 17, 2010
SD partitions
Here is a SD card with one Fat32 partition and another one ext2 partition.
Windows 5.x machine reports only about the first Fat32 and of course does not recognize the ext2. Using an utility called dskwipe, we can see the list of partitions as Window sees them:
C:\>dskwipe.exe -l
one of the lines will be the SD device name (0 here - the whole device, 1 - the first partition):
\Device\Harddisk1\Partition0
To access to the ext2 partition from CoLinux running atop the Windows we need to do the following:
Windows 5.x machine reports only about the first Fat32 and of course does not recognize the ext2. Using an utility called dskwipe, we can see the list of partitions as Window sees them:
C:\>dskwipe.exe -l
one of the lines will be the SD device name (0 here - the whole device, 1 - the first partition):
\Device\Harddisk1\Partition0
To access to the ext2 partition from CoLinux running atop the Windows we need to do the following:
- Add to the colinux.conf the following line
cobd1="\Device\Harddisk1\Partition0" - Load CoLinux and run fdisk /dev/cobd1
- Press 'u' to switch to block counting mode
- Press 'p' to output the partitions
- Write down the starting point of the ext2 partition multiplied by 512, say it will be 17754534912
- Setup a loop device:
losetup -o 17754534912 /dev/loop1 /dev/cobd1 - Check the file system integrity:
e2fsck /dev/loop1 - Mount the partition:
mount /dev/loop1 /media/sd_ext2
Sunday, December 20, 2009
Android dialog bug fixed
Cool, in Android SDK 2.0 the bug in which onPrepareDialog was not called on an activities reincarnation is fixed.
Subscribe to:
Posts (Atom)