1) Create your ViewTargets, for example 4 targets (you can create n targets) and put targets into an array declared as a private attribute in your Activity class : private ViewTarget[] targets;
final ViewTarget target1 = new ViewTarget(textview1);
final ViewTarget target2 = new ViewTarget(textview2);
final ViewTarget target3 = new ViewTarget(textview3);
final ViewTarget target4 = new ViewTarget(textview4);
targets = new ViewTarget[] { target1, target2,target3,target4};
2) Create the recursive method :
private void toStep(final String title, final String description,Target target, final int i) {
final ShowcaseView.Builder showCaseBuilder = new ShowcaseView.Builder(ShowCaseActivity.this);
showCaseBuilder.setTarget(targets[i]);
showCaseBuilder.setContentTitle(title.replace("[i]", ""+i));
showCaseBuilder.setContentText(description.replace("[i]", ""+i));
showCaseBuilder.setShowcaseEventListener(new OnShowcaseEventListener() {
@Override
public void onShowcaseViewTouchBlocked(MotionEvent motionEvent) {
}
@Override
public void onShowcaseViewShow(ShowcaseView showcaseView) {
}
@Override
public void onShowcaseViewHide(ShowcaseView showcaseView) {
try {
toStep(title, description, targets[i+1], i+1);
} catch(Exception ex) {
}
}
@Override
public void onShowcaseViewDidHide(ShowcaseView showcaseView) {
}
});
showCaseBuilder.build();
}
3) Finally you can call the method that displays Showcases :
toStep("Title for showcase [i]", " Description for showcase [i] ",targets[0], 0);
1) Create your ViewTargets, for example 4 targets (you can create n targets) and put targets into an array declared as a private attribute in your Activity class :
private ViewTarget[] targets;
2) Create the recursive method :
3) Finally you can call the method that displays Showcases :
toStep("Title for showcase [i]", " Description for showcase [i] ",targets[0], 0);
I hope this will be helpful for you :)