List of usage examples for android.text.format Time parse3339
public boolean parse3339(String s)
From source file:Main.java
/** * Parse the given string as a RFC 3339 timestamp, returning the value as * milliseconds since the epoch.//from w w w.j ava 2s . c om */ public static long parseTime(String timestamp) { final Time time = new Time(); time.parse3339(timestamp); return time.toMillis(false); }
From source file:com.samsung.msf.youtubeplayer.client.util.FeedParser.java
public List<Entry> readJson(InputStream stream) { List<Entry> entries = new ArrayList<Entry>(); // NEW Youtube API V3.0 try {// www .j a v a 2 s . com // Convert this response into a readable string String jsonString = convertToString(stream); JSONObject json = new JSONObject(jsonString); JSONArray jsonArray = json.getJSONArray("items"); Log.d(TAG, "readJson jsonArray item count = " + jsonArray.length()); // Loop round our JSON list of videos creating Video objects to use within our app for (int i = 0; i < jsonArray.length(); i++) { long publishedOn = 0; JSONObject jsonObject = jsonArray.getJSONObject(i); // The title of the video String id; try { id = jsonObject.getJSONObject("id").getString("videoId"); } catch (JSONException e) { continue; } JSONObject snippet = jsonObject.getJSONObject("snippet"); String title = snippet.getString("title"); String uploaded = snippet.getString("publishedAt"); Log.d(TAG, "id = " + id + ", title = " + title + "uploaded = " + uploaded); Time t = new Time(); t.parse3339(uploaded); publishedOn = t.toMillis(false); // The url link back to YouTube, this checks if it has a mobile url // if it doesnt it gets the standard url String url = ""; JSONObject thumnail = snippet.getJSONObject("thumbnails"); JSONObject defaultThumnail = thumnail.getJSONObject("default"); JSONObject highThumnail = thumnail.getJSONObject("high"); String thumbUrl; try { thumbUrl = highThumnail.getString("url"); } catch (JSONException ignore) { thumbUrl = defaultThumnail.getString("url"); } Log.d(TAG, "thumbUrl = " + thumbUrl); entries.add(new Entry(id, title, url, publishedOn, thumbUrl, 0)); // installed as default false; } } catch (IOException e) { Log.e(TAG, "Feck", e); } catch (JSONException e) { Log.e(TAG, "Feck", e); } return entries; }
From source file:org.tomdroid.Note.java
public Time getLastChangeDate() { Time time = new Time(); time.parse3339(lastChangeDate); return time; }
From source file:com.tdispatch.passenger.model.BookingData.java
public BookingData setPickupDate(String stamp) { // date is RFC 3339 Time time = new Time(); time.parse3339(stamp); mPickupDateString = stamp;//from w w w . ja va2s . co m mPickupDate = new Date(time.toMillis(false)); return this; }