Back to project page Weather.
The source code is released under:
Apache License
If you think the Android project Weather listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.volitic.weather; /*from ww w .ja va2 s .c o m*/ import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteQueryBuilder; import android.util.Log; import com.readystatesoftware.sqliteasset.SQLiteAssetHelper; public class DatabaseHelper extends SQLiteAssetHelper { private static final String DATABASE_NAME = "weather.db"; private static final int DATABASE_VERSION = 1; public static final String TABLE_NAME = "locations"; public static final String COL_CITY = "city"; public static final String COL_COUNTRY = "country"; public static final String COL_TIMEZONE = "timezone"; public static final String COL_LATITUDE = "latitude"; public static final String COL_LONGITUDE = "longitude"; public DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } public Cursor getAllLocations(){ return getReadableDatabase().query(TABLE_NAME, new String[]{"_id","city"}, null, null, null, null, null, null); } public Cursor getLocationFilteredBy(CharSequence constraint ){ String rules = DatabaseHelper.COL_CITY + " LIKE '" + constraint +"%'"; return getReadableDatabase().query( TABLE_NAME, new String[]{"_id",COL_CITY}, rules, null, null, null, null, null); } }