Android instructions when open the application at first time? [closed]

▼魔方 西西 提交于 2019-12-18 10:24:42

问题


Do you know this

Well I want create something like this screen. When I open for the first time the application I want open this screen and display a context.. How is possible? I don't know what search for this type of thing..


回答1:


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ...
    if (isFirstTime()) {
        // What you do when the Application is Opened First time Goes here
    }
    ...
}


/***
 * Checks that application runs first time and write flag at SharedPreferences 
 * @return true if 1st time
 */
private boolean isFirstTime()
{
    SharedPreferences preferences = getPreferences(MODE_PRIVATE);
    boolean ranBefore = preferences.getBoolean("RanBefore", false);
    if (!ranBefore) {
        // first time
        SharedPreferences.Editor editor = preferences.edit();
        editor.putBoolean("RanBefore", true);
        editor.commit();
    }
    return !ranBefore;
}



回答2:


I've found a nice library for showing a tutorial to the user about specific items on the screen, called "ShowCase view library" .

but the library quite buggy and sometimes puts its textural items outside the screen (for example when the device is rotated) .

the alternative similar library i've found is "SuperToolTips" .




回答3:


I'm using MaterialShowcaseView https://github.com/deano2390/MaterialShowcaseView . Very easy to use, works well, it's customisable, has support for sequence of instructions. Solved many issued that ShowCase view library has.



来源:https://stackoverflow.com/questions/19927199/android-instructions-when-open-the-application-at-first-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!