Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;
import android.content.SharedPreferences;

import android.preference.PreferenceManager;

public class Main {
    public static void saveWeatherInfo(Context context, String cityName, String tempMin, String tempMax,
            String weatherDay, String weatherNight, String publishTime, String date1DayPic, String date2DayPic,
            String date3DayPic, String date4DayPic, String date5DayPic, String nowPic, String comf, String drsg,
            String flu, String sport, String trav, String uv) {
        SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit();
        editor.putBoolean("city_selected", true);
        editor.putString("city_name", cityName);
        editor.putString("temp_min", tempMin);
        editor.putString("temp_max", tempMax);
        editor.putString("weather_day", weatherDay);
        editor.putString("weather_night", weatherNight);
        editor.putString("publish_time", publishTime);
        editor.putString("date1_day_pic", date1DayPic);
        editor.putString("date2_day_pic", date2DayPic);
        editor.putString("date3_day_pic", date3DayPic);
        editor.putString("date4_day_pic", date4DayPic);
        editor.putString("date5_day_pic", date5DayPic);
        editor.putString("now_pic", nowPic);
        editor.putString("comf_index", comf);
        editor.putString("drsg_index", drsg);
        editor.putString("flu_index", flu);
        editor.putString("sport_index", sport);
        editor.putString("trav_index", trav);
        editor.putString("uv_index", uv);
        editor.commit();
    }
}