The tutorial when you first log into the application?

I am programming an application using android studio. I want to know how I can make a tutorial that users will see only the first time this application. A tutorial, such as an image or screenshots

Can someone help me? Thanks

+4
source share
4 answers

I came across this thread, looking for a solution to run the tutorial for the first time only (as rbaleksandar ), so in case it is useful to someone someday, here is a solution template that works for me (using the API SharedPreferences) :

@Override
    protected void onResume() {
        super.onResume();
        String tutorialKey = "SOME_KEY";
        Boolean firstTime = getPreferences(MODE_PRIVATE).getBoolean(tutorialKey, true);
        if (firstTime) {
            runTutorial(); // here you do what you want to do - an activity tutorial in my case
            getPreferences(MODE_PRIVATE).edit().putBoolean(tutorialKey, false).apply();
        }
    }

EDIT - BONUS. - ShowcaseView ( - ). -, , singleShot(long) - SharedPreferences, - . ( ):

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_single_shot);

        Target viewTarget = new ViewTarget(R.id.button, this);
        new ShowcaseView.Builder(this)
                .setTarget(viewTarget)
                .setContentTitle(R.string.title_single_shot)
                .setContentText(R.string.R_string_desc_single_shot)
                .singleShot(42)
                .build();
    }
0

, .

Android:

, , .

, , , .

:

, , , :

Button button = (Button)findViewById(R.id.button);

:

TourGuide mTourGuideHandler = TourGuide.init(this).with(TourGuide.Technique.Click)
        .setPointer(new Pointer())
        .setToolTip(new ToolTip().setTitle("Welcome!").setDescription("Click on Get Started to begin..."))
        .setOverlay(new Overlay())
        .playOn(button);

, !

+3

, , ? ( , , ), ?. , :

, Android , , (SQLite), ( , YAML, XML - ). , , , tutorial_on : false, tutorial_on : 1 .. , ​​.

, , ( ) , . ( ):

  • tutorial_on
  • tutorial_on true/1

    2.1

    2.2 tutorial_on false/0

    2.3

, , , , , .

, Don't show tutorial anymore, ( ..). :

  • - ( , ). , , .
  • - - , , . . , . ( tutorial_on ), - .
+2

Source: https://habr.com/ru/post/1629789/


All Articles