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;
import android.preference.PreferenceManager;

public class Main {
    private static void saveWeatherInfo(Context context, String cityName, String pm25, String temp, String desc,
            String time) {

        SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit();

        editor.putBoolean("city_selected", true);
        editor.putString("city_name", cityName);
        editor.putString("pm25", pm25);
        editor.putString("temp", temp);
        editor.putString("desc", desc);
        editor.putString("time", time);
        editor.commit();

    }
}