I'm lo开发者_如何转开发oking to figure out a solution for helping a user enter some configuration data during the first time it's executed. I have a main activity that shows a list of photos in a grid.
During the onCreate method for the main activity, if I find that a user has not configured the app before, I switch to a series of two activities. The user fills out the required data in those two activities (think wizard-style, one after another). Once they have entered data on the second activity, they are shown the original main activity.
Is this a standard, or preferred way to do things? I couldn't find an easier way to do this, or a built-in way.
Instead of using onCreate, is there a way to programatically choose the first activity based on whether it's the first time the app has been run or not?
Thanks, Kevin
use below code for this problem
if( getSharedPreferences("FirstTime", 0).getBoolean("check", true))
{
getSharedPreferences("FirstTime", 0) .edit().putBoolean("check", false);
/////////Write First Time code
}
else
{
/////Write Second Time code
}
精彩评论