0

In this code example I have a single TapTargetView working:

if (controllerVisible && playerView.isControllerFullyVisible()) {
    if (setPrefs.firstRun) {
        TapTargetView.showFor(PlayerActivity.this,
            TapTarget.forView(buttonSettings, getString(R.string.onboarding_settings_title),
                    getString(R.string.onboarding_settings_description))
                    .outerCircleColor(R.color.blue)
                    .targetCircleColor(R.color.white)
                    .titleTextSize(22)
                    .titleTextColor(R.color.white)
                    .descriptionTextSize(14)
                    .cancelable(true),
            new TapTargetView.Listener() {
                @Override
                public void onTargetClick(TapTargetView view) {
                    super.onTargetClick(view);
                    buttonOpen.performClick();
                }
            });
        setPrefs.markFirstRun();
    }
}

But I cannot work out how to create a TapTargetSequence using the following example:

TapTargetSequence(this)
    .targets(
        TapTarget.forView(buttonSettings, getString(R.string.onboarding_settings_title),
            getString(R.string.onboarding_settings_description))
            .outerCircleColor(R.color.blue)
            .targetCircleColor(R.color.white)
            .titleTextSize(22)
            .titleTextColor(R.color.white)
            .descriptionTextSize(14)
            .cancelable(true),
        TapTarget.forView(buttonMedia, getString(R.string.onboarding_media_title),
            getString(R.string.onboarding_media_description))
            .outerCircleColor(R.color.blue)
            .targetCircleColor(R.color.white)
            .titleTextSize(22)
            .titleTextColor(R.color.white)
            .descriptionTextSize(14)
            .cancelable(true))

I'm having a great deal of trouble with this could someone please help me to figure this out.

Thank you

Brenton
  • 35
  • 11

2 Answers2

1

I recommend to use .start(); at last.
Like .cancleable(true)).start();.

Yunnosch
  • 26,130
  • 9
  • 42
  • 54
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 28 '22 at 10:31
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31393157) – Mad Physicist Mar 30 '22 at 19:04
1

You forgot to add "start()" method at the end and also TapTargetSequence.Listener. Try the below code, it should work.

    TapTargetSequence(this)
    .targets(
        TapTarget.forView(buttonSettings, getString(R.string.onboarding_settings_title),
            getString(R.string.onboarding_settings_description))
            .outerCircleColor(R.color.blue)
            .targetCircleColor(R.color.white)
            .titleTextSize(22)
            .titleTextColor(R.color.white)
            .descriptionTextSize(14)
            .cancelable(true),
        TapTarget.forView(buttonMedia, getString(R.string.onboarding_media_title),
            getString(R.string.onboarding_media_description))
            .outerCircleColor(R.color.blue)
            .targetCircleColor(R.color.white)
            .titleTextSize(22)
            .titleTextColor(R.color.white)
            .descriptionTextSize(14)
            .cancelable(true)).start()
object : TapTargetSequence.Listener {
            override fun onSequenceFinish() {
                Toast.makeText(this, "Sequence Finished!", Toast.LENGTH_SHORT).show()
            }

            override fun onSequenceStep(lastTarget: TapTarget?, targetClicked: Boolean) {
                Toast.makeText(this, "Great", Toast.LENGTH_SHORT).show()
            }

            override fun onSequenceCanceled(lastTarget: TapTarget?) {
            }
        }