开发者

JSONArray and JSONObject for google calendar

开发者 https://www.devze.com 2023-01-27 09:57 出处:网络
I am trying to create an android app to read the information from google calender using the json output.

I am trying to create an android app to read the information from google calender using the json output.

http://www.google.com/calendar/feeds/developer-calendar@google.com/public/full?alt=json

Can anyone tell me how I can accomplish this using JSONArray开发者_JS百科 and JSONObject options available in android sdk.

Greatly appreciate any help on this...

Thanks in advance...


Here's an example

// Query the API for content
        String content = getUrlContent(String.format(WIKTIONARY_PAGE,
                encodedTitle, expandClause));
        try {
            // Drill into the JSON response to find the content body
            JSONObject response = new JSONObject(content);
            JSONObject query = response.getJSONObject("query");
            JSONObject pages = query.getJSONObject("pages");
            JSONObject page = pages.getJSONObject((String) pages.keys().next());
            JSONArray revisions = page.getJSONArray("revisions");
            JSONObject revision = revisions.getJSONObject(0);
            return revision.getString("*");
        } catch (JSONException e) {
            throw new ParseException("Problem parsing API response", e);
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消