Skip to content

Instantly share code, notes, and snippets.

@iewnait
Created June 5, 2012 23:10
Show Gist options
  • Save iewnait/2878707 to your computer and use it in GitHub Desktop.
Save iewnait/2878707 to your computer and use it in GitHub Desktop.
Example code for WorldClock.query(ContentResolver cr, String[] projection)
// Set this to null to get all Column.
String[] projections = new String [] {
WorldClock.Columns.CITY_UID,
WorldClock.Columns.NAME,
WorldClock.Columns.LONGITUDE,
WorldClock.Columns.TIMEZONE
};
Cursor cur = WorldClock.query(getContext().getContentResolver(),
projections
);
while (cur.moveToNext()) {
for (int i = 0; i <cur.getColumnCount(); i++) {
WorldClock.Location wcl = WorldClock.getLocationFromCursor(cur);
// Do something useful with the ID and NAME of the calendars.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment