i have a ListView for which i have made a custom adapter which extends the BaseAdapter class in android.
this adapter gets events from a database which occur on the different days of a month.
question
in the getCount method i am returning the the number of days in the specific month.
now some of the days may not have an event. my adapter will still want views for the all the days…
right now i am returning null when there is no event on a specific day. this is causing an execption.
how do i skip a view when there are no events on that day?
like in listactivity there is a textview that will be automatically shown when there is no data in the list (its id should be empty), can i do something of that sort in here?
You should
events in the
getCount()method,your adapter’s
getViewmethod. This view then will be there, but with 0 size (android:height="wrap_content" or), or no"0dp"
visibility(android:visibility="invisible" or "gone")