I have a gridview that is populated by a cursor that fetches data from SQLITE database. At times, there is no data to be shown. This shows a blank activity.
I had earlier used listview where I could use @android:id/empty to set an emptyView like “no data found”.
Is there any similar feature for GridView that I can make use of?
Kindly help.
ListActivity and
ListFragmentsimply search for a view with that ID and callYou can mimic this behavior in your
GridView..Note that you don’t need to set your empty view’s ID to
@android:id/empty. It can be anything you want as long as you are setting it in code.Link to GridView setEmptyView docs