I created CustomListView. now I want to Show, 'ShowCaseView' when I get my listview is empty. Will It possible or not.
Asked
Active
Viewed 124 times
-2
-
It is possible, check if list size is 0 and proceed to show the showcaseview – Akshay Bhat 'AB' Aug 05 '16 at 11:10
-
check if `array==null || array.isEmpty()` then show ShowCaseView else show listview. – Jitesh Prajapati Aug 05 '16 at 11:34
-
How can I handle notifyDataSetChanged() method. because in my case it will automatically refresh listview? – Nik Aug 05 '16 at 11:57
-
Is there any way, so that i display ShowcaseView while listview.setEmptyView () method calls. – Nik Aug 05 '16 at 12:00
2 Answers
0
If your goal is to create a ShowCaseView with no target since your list view is empty you can use;
ShowcaseView.Builder showCaseViewBuild = new ShowcaseView.Builder(mActivity)
.setTarget(Target.NONE)
.[your_other_configuration_stuff_here];
And then if you are trying to trigger this when the list view is empty, you can set a listener for changes to the ListView hierarchy like;
ListView lv = new ListView(mActivity);
//[your ListView setup code here... then the listener below]
lv.setOnHierarchyChangeListener(new ViewGroup.OnHierarchyChangeListener() {
@Override
public void onChildViewAdded(View parent, View child) {
}
@Override
public void onChildViewRemoved(View parent, View child) {
// trigger your ShowCaseView here when no children are left
// TODO
}
});

Onyx Ape
- 1
- 2