• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Problem with getting the app first run using shared prefferences

wisien92

Lurker
Jul 3, 2014
2
0
I am new to android programming and i have found one issue. I want to determin first run of app and with my method the app never starts :/ tha app proces is killed right away.

I want to chech that in my splashscreen activity and here is my code:

Code:
public class SplashScreen extends Activity {

    final Intent mainMenuIntent = new Intent(this, MainMenu.class);

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);

        SharedPreferences app_preferences =               PreferenceManager.getDefaultSharedPreferences(this);

        if (app_preferences.getBoolean("firstTime", false)) {
            Log.v("SplashScreenActivity","Pirszy raz!!!!");
        }

        mainMenuIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(mainMenuIntent);
    }
}
What am I doing wrong here ?
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones