Code example for SharedPreferences

Methods: getBoolean

0
    private boolean shouldShowEula(Activity activity) {
        if(Preferences.getBoolean(PREFERENCE_EULA_ACCEPTED, false))
            return false; 
 
        SharedPreferences p = activity.getSharedPreferences("eula", Activity.MODE_PRIVATE); //$NON-NLS-1$
        if(p.getBoolean(PREFERENCE_EULA_ACCEPTED, false))
            return false; 
 
        if(taskService.countTasks() > 0)
            return false; 
        return true; 
    } 
 
    private static void accept(Activity activity) {
        if (activity instanceof EulaCallback) {
            ((EulaCallback)activity).eulaAccepted();
        } 
        Preferences.setBoolean(PREFERENCE_EULA_ACCEPTED, true);
        StatisticsService.reportEvent(StatisticsConstants.EULA_ACCEPTED); 
    }