Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;

import android.content.SharedPreferences;

public class Main {
    public static void saveProperty(final Context context, String propertyName, int propertyValue) {
        SharedPreferences preferences = context.getSharedPreferences("YTWPreferences", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putInt(propertyName, propertyValue);
        editor.commit();
    }

    public static void saveProperty(final Context context, String propertyName, boolean propertyValue) {
        SharedPreferences preferences = context.getSharedPreferences("YTWPreferences", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putBoolean(propertyName, propertyValue);
        editor.commit();
    }
}