java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup
at android.view.ViewGroup.addView(ViewGroup.java:4952)
at android.view.ViewGroup.addView(ViewGroup.java:4917)
at com.takusemba.spotlight.SpotlightView.startTarget(SpotlightView.kt:116)
at com.takusemba.spotlight.Spotlight.showTarget(Spotlight.kt:96)
Tried many things without success. I'm using java and in a Fragment
myView is found using Butterknife, and if I put a breakpoint before starting spotlight, it's not null
private List getTargets() {
List targets = new ArrayList<>();
targets.add(new Target.Builder().setAnchor(myView).setShape(new Circle(100f)).build());
return targets;
}
@override
public void onViewCreated(View view, @nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
new Spotlight.Builder(getActivity()).setTargets(getTargets()).build().start;
}
I just saw that if I put a .setOverlay(layout) it works fine.
I don't understand why it's mandatory to use a layout, furthermore it would be great to return a clearer exception message
Version 2.0.2
java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup at android.view.ViewGroup.addView(ViewGroup.java:4952) at android.view.ViewGroup.addView(ViewGroup.java:4917) at com.takusemba.spotlight.SpotlightView.startTarget(SpotlightView.kt:116) at com.takusemba.spotlight.Spotlight.showTarget(Spotlight.kt:96)
Tried many things without success. I'm using java and in a Fragment myView is found using Butterknife, and if I put a breakpoint before starting spotlight, it's not null
private List getTargets() { List targets = new ArrayList<>(); targets.add(new Target.Builder().setAnchor(myView).setShape(new Circle(100f)).build()); return targets; }
@override public void onViewCreated(View view, @nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); new Spotlight.Builder(getActivity()).setTargets(getTargets()).build().start; }