Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;

import android.content.SharedPreferences;

import android.preference.PreferenceManager;

public class Main {
    public static boolean shouldShowTutorial(Context context, String tutorialName) {
        return shouldShowTutorial(context, tutorialName, 0);
    }

    public static boolean shouldShowTutorial(Context context, String tutorialName, int limit) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        int shown = prefs.getInt("tutorial" + tutorialName, 0);
        prefs.edit().putInt("tutorial" + tutorialName, shown + 1).apply();
        return limit == shown;
    }
}