@@ -0,0 +1,2052 @@
+package com.example.test.myweather.database;%0A%0Aimport android.content.ContentValues;%0Aimport android.content.Context;%0Aimport android.database.Cursor;%0Aimport android.database.sqlite.SQLiteDatabase;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * Created by test on 8/16/2015.%0A */%0Apublic class MyWeatherDB %7B%0A    private static final String DA_NAME = %22MyWeatherDB%22;%0A    private static MyWeatherDB myWeatherDB;%0A    private static SQLiteDatabase sqLiteDatabase;%0A    private static int VERSION = 1;%0A%0A    private MyWeatherDB(Context context) %7B%0A        MyWeatherOpenHelper myWeatherOpenHelper = new MyWeatherOpenHelper%0A                (context, DA_NAME, null, VERSION);%0A        sqLiteDatabase = myWeatherOpenHelper.getWritableDatabase();%0A    %7D%0A%0A    private synchronized static MyWeatherDB getInstance(Context context) %7B%0A        myWeatherDB = new MyWeatherDB(context);%0A        return myWeatherDB;%0A    %7D%0A%0A    public void saveProvince(Province province) %7B%0A        if (province != null) %7B%0A            ContentValues contentValues = new ContentValues();%0A            contentValues.put(%22province_name%22, province.getProvince_name());%0A            contentValues.put(%22province_code%22, province.getProvince_code());%0A            sqLiteDatabase.insert(%22Province%22, null, contentValues);%0A        %7D%0A    %7D%0A%0A    public List%3CProvince%3E loadProvince() %7B%0A        List%3CProvince%3E list = new ArrayList%3CProvince%3E();%0A        Cursor cursor = sqLiteDatabase.query(%22Province%22, null, null, null, null, null, null);%0A        if (cursor.moveToFirst()) %7B%0A            do %7B%0A                Province province = new Province();%0A                province.setId(cursor.getInt(cursor.getColumnIndex(%22id%22)));%0A                province.setProvince_name(cursor.getString(cursor.getColumnIndex(%22province_name%22)));%0A                province.setProvince_code(cursor.getString(cursor.getColumnIndex(%22province_code%22)));%0A                list.add(province);%0A            %7Dwhile (cursor.moveToNext());%0A        %7D%0A        if (cursor != null) %7B%0A            cursor.close();%0A        %7D%0A        return list;%0A    %7D%0A%0A%7D%0A

create MyWeatherDB version 1