Android instructions when open the application at first time?
14,442
Solution 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;
}
Solution 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" .
Related videos on Youtube
Author by
David_D
Updated on September 16, 2022Comments
-
David_D about 1 year
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..
-
Sunil Mishra about 10 yearsCheck this github.com/Espiandev/ShowcaseView
-
-
David_D about 10 yearsso maybe i could use this library github.com/Espiandev/ShowcaseView and write what i need inside
isFirstTime
? -
Android Noob about 10 yearsWrite the above code as it is in your application You dont have to use any library
-
David_D about 10 yearsmmh.. well..it's not what i'm looking for.. but it could be another way..
-
Android Noob about 10 yearsYes this could be one way, I have done with this method, You can also go with this.
-
David_D almost 10 yearsIt's not what i was looking for but it goes well.. so i accepted your answere
-
Joaquin Iurchuk over 8 yearsWhat was accepted here? I don't understand...
-
Aphex almost 8 yearsBe careful when reading the
RanBefore
value from one activity and writing it from another.getPreferences
is private to each activity.