Reputation: 1341
This might seem a little weird!!
But I was wondering if I could add some help on my app .which comes when You first open your app and when you touch the screen it vanishes(Only comes in first run).
The problem is I didn't even know what is this thing called I tried a search on google but I'm nowhere near it.
It will be very helpful if anyone can provide some info about that(what is it called ,How to add it in your App)
Thanks !!
Upvotes: 2
Views: 154
Reputation: 3359
Try this!
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
boolean previouslyStarted = prefs.getBoolean(getString(R.string.pref_previously_started), false);
if(!previouslyStarted){
SharedPreferences.Editor edit = prefs.edit();
edit.putBoolean(getString(R.string.pref_previously_started), Boolean.TRUE);
edit.commit();
**// when the application is previously opened
//Show your help Test**
}
else
{
**// when the application is opened very First Time**
Intent intent = new Intent(MainActivity.this, Home_Module.class);
MainActivity.this.startActivity(intent);
}
This will Help You.
It stores your application status that it is previously opened or not?
Upvotes: 0
Reputation: 28823
Check my answer for some thing on first setup.
Put this on first time run.
shPref = getSharedPreferences(PREFS_NAME, MODE_WORLD_READABLE);
SharedPreferences.Editor pref_editor = shPref.edit();
pref_editor.putBoolean("first_time", false);
pref_editor.commit();
Check it like this:
shPref = getSharedPreferences(PREFS_NAME, MODE_WORLD_READABLE);
boolean isFirstRun = myPrefs.getBoolean("first_run",false);
if(isFirstRun){
txtViewHelp.setVisibility(View.VISIBLE);
//logic of making it invisible on touch outside
}
else
txtViewHelp.setVisibility(View.GONE);
Hope this helps.
Upvotes: 3