-2

I created CustomListView. now I want to Show, 'ShowCaseView' when I get my listview is empty. Will It possible or not.

Nik
  • 1,991
  • 2
  • 13
  • 30

2 Answers2

0

Perhaps before initialization run or check size != 0

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