Created
June 5, 2012 23:20
-
-
Save iewnait/2878754 to your computer and use it in GitHub Desktop.
Example code for WorldClock.query(ContentResolver cr, String[] projection, String where, String[] whereArgs, String orderBy)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String[] projections = new String [] { | |
WorldClock.Columns.CITY_UID, | |
WorldClock.Columns.NAME, | |
WorldClock.Columns.LONGITUDE, | |
WorldClock.Columns.TIMEZONE | |
} | |
String selection = WorldClock.Columns.TIMEZONE + " = '?'"; | |
String[] selectionArgs = new String[] {"Asia/Tokyo"}; | |
// Sort data by WorldClock.Columns.CITY_UID | |
Cursor cur = WorldClock.query(getContext().getContentResolver(), | |
projections, | |
selection, | |
selectionArgs, | |
WorldClock.Columns.CITY_UID | |
); | |
while (cur.moveToNext()) { | |
WorldClock.Location wlc = WorldClock.getLocationFromCursor(cur); | |
// Do something useful with the value. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment