Skip object in BasicAdapter / CustomListAdapter

by 艁ukasz Warcho艂 » Fri, 27 Feb 2009 21:42:39 GMT


Sponsored Links
 Hi all,
I have my own ListAdapter  drawing my list. But i have a question. Is it 
possible to skip(not draw) object?
For example: I have a ArrayList with things to draw, and dont wanto to 
draw one at positon 2. Anyone nows how to?
Thanks.

--~--~---------~--~----~------------~-------~--~----~



Skip object in BasicAdapter / CustomListAdapter

by Mark Murphy » Fri, 27 Feb 2009 21:47:15 GMT


 


Expanding on your example, let us assume you have a six-item list, and
you do not want to draw the one at position 2 -- you only want to draw
positions 0, 1, 3, 4, and 5.

You would need to override getCount(), getItem(), and every other
Adapter method that knows about the number and positions of objects. You
would have getCount() return 5 instead of 6 (since you are only drawing
5) and have getItem(), getView(), etc. know to subtract 1 from the
supplied position if the supplied position > 2.

It would be far simpler to just remove the offending item from the list
in the first place, if possible.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Skip object in BasicAdapter / CustomListAdapter

by 艁ukasz Warcho艂 » Fri, 27 Feb 2009 21:50:28 GMT


 Yeah, i was thinking about deleting it from the list, but i thought taht 
there is any way of returning null from GetView(). Ok I think i'll 
delele this file form list. Thanks

Mark Murphy pisze:




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. [WTI & WTAsk] Maret 3 Samsung galaxy masuk ke Indonesia, nexus s gak ada kabar kapan masuk ke sini

dari vivanews
http://teknologi.vivanews.com/news/read/205459-maret--3-samsung-galaxy-masuk-ke-indonesia

brikut katanya yg akan masuk ke indonesia maret mendatang,,
*1. Samsung Galaxy Ace*
*2. Samsung Galaxy Fit*
*3. Samsung Galaxy S II*
*
*
Kalo nexus s kira2 bakal didatangkan juga gak yah??

-- 
===============

2. [WTA] connect ad hoc dengan Android

Dear RR,
dari kemarin nyoba2 supaya HTC Desire saya bisa konek internet tanpa pake
koneksi gprs/3G
karena di kampus hotspotnya harus pake certificate jadinya harus cari akal
akhirnya saya coba pake ad hoc ... entah knp selalu ga bisa connect ad hoc
bagaimana cara supaya desire bisa connect ke ad hoc laptop yang ada ?
kalau saya cari2 seh bisa pake aplikasi third-party
tapi masih tetap tidak bisa menggunakan internet
kira2 gmn lagi ya ?
saya pake ROM MIUI 1.2.11

Best Regards,
Wijanarko Sukma

-- 
===============

3. android music player can't play mp3 format file

4. Exception while calling web service----java.net.SocketException: Permission denied

5. "Conversion to Dalvik format failed with error 1" when using jmDNS.jar

6. Create a pipe file

7. cts test result