Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.Activity;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class Main {
    private static SharedPreferences myPreferences;
    private static String myVill;
    private static String myDist;

    public static void changeToVillage(Activity theActivity) {
        initializeVillage(theActivity);
        myPreferences.edit().putString("Village", myVill);
        myPreferences.edit().putString("District", myDist);
    }

    private static void initializeVillage(Activity theActivity) {
        if (myPreferences == null) {
            myPreferences = PreferenceManager.getDefaultSharedPreferences(theActivity.getApplicationContext());
        }
    }
}