// Path: app/src/main/java/me/codpoe/onlyweather/model/City.java
// public class City {
//     private int id;
//     private String cityName;
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public String getCityName() {
//         return cityName;
//     }
// 
//     public void setCityName(String cityName) {
//         this.cityName = cityName;
//     }
// }


import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import java.util.ArrayList;
import java.util.List;
import me.codpoe.onlyweather.model.City;
package me.codpoe.onlyweather.db;




/**
 * Created by Codpoe on 2016/5/12.
 */
public class OnlyWeatherDB {
    // 数据库名
    public static final String DB_NAME = "only_weather";
    // 数据库版本
    public static final int VERSION = 1;

    private static OnlyWeatherDB sOnlyWeatherDB;
    private SQLiteDatabase mSQLiteDatabase;

    // 构造方法私有化
    private OnlyWeatherDB(Context context) {
        OnlyWeatherOpenHelper dbHelper = new OnlyWeatherOpenHelper(context,
                DB_NAME, null, VERSION);
        mSQLiteDatabase = dbHelper.getWritableDatabase();
    }

    /**
     * 对外的方法
     */

    // 获取 OnlyWeatherDB 的实例
    public synchronized static OnlyWeatherDB getInstance(Context context) {
        if(sOnlyWeatherDB == null) {
            sOnlyWeatherDB = new OnlyWeatherDB(context);
        }
        return sOnlyWeatherDB;
    }

    // 将 City 实例存储到数据库
// Path: app/src/main/java/me/codpoe/onlyweather/model/City.java
// public class City {
//     private int id;
//     private String cityName;
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public String getCityName() {
//         return cityName;
//     }
// 
//     public void setCityName(String cityName) {
//         this.cityName = cityName;
//     }
// }


// Path: app/src/main/java/me/codpoe/onlyweather/db/OnlyWeatherDB.java
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import java.util.ArrayList;
import java.util.List;
import me.codpoe.onlyweather.model.City;

package me.codpoe.onlyweather.db;




/**
 * Created by Codpoe on 2016/5/12.
 */
public class OnlyWeatherDB {
    // 数据库名
    public static final String DB_NAME = "only_weather";
    // 数据库版本
    public static final int VERSION = 1;

    private static OnlyWeatherDB sOnlyWeatherDB;
    private SQLiteDatabase mSQLiteDatabase;

    // 构造方法私有化
    private OnlyWeatherDB(Context context) {
        OnlyWeatherOpenHelper dbHelper = new OnlyWeatherOpenHelper(context,
                DB_NAME, null, VERSION);
        mSQLiteDatabase = dbHelper.getWritableDatabase();
    }

    /**
     * 对外的方法
     */

    // 获取 OnlyWeatherDB 的实例
    public synchronized static OnlyWeatherDB getInstance(Context context) {
        if(sOnlyWeatherDB == null) {
            sOnlyWeatherDB = new OnlyWeatherDB(context);
        }
        return sOnlyWeatherDB;
    }

    // 将 City 实例存储到数据库
    public Boolean saveCity(City city) {