varunkr varunkr - 1 month ago 10
Android Question

Android: How to create tutorial at app start like in Google Analytics app?

In my app I want to have a tutorial when the user installs the app for the first time. I used google analytics app recently and the way they do it looks perfect to me.

enter image description here

I have seen such views in other apps as well. Is this some standard view or does a library exist for it? Or will I have to write it from scratch using a view pager? Thanks in advance !!

Answer

I think this 3rd party library is best for these types of tutorials.Here is one screen shot:

enter image description here

This is another library.

Another one is here.

You can also try this.

And last one is my favourite.

You can use this ViewPageIndicator also.

To make sure that this tutorial is shown only 1st time, you can use shared preference. sample code is:

public class MainActivity extends Activity {
public static final String MyPrefs = "MyPrefs";
...

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

    SharedPreferences sp = getSharedPreferences(MyPrefs, Context.MODE_PRIVATE);
    if (!sp.getBoolean("first", false)) {
        SharedPreferences.Editor editor = sp.edit();
        editor.putBoolean("first", true);
        editor.commit();
        Intent intent = new Intent(this, SampleCirclesDefault.class); //call your ViewPager class
        startActivity(intent);
    }
}
}
Comments