简体   繁体   中英

Parsing data from internet in a Android App

Hey folks so here i am starting out with a few baby steps in Android Programming . i went through the relevant videos and feel confident to jump into the pool . My motivation is to make a simple app that gives the waiting time for my school buses at the university . The examples that i saw made using of JSON parsing to parse data from the internet specifically twitter . So how do i check if the website that i want to pull in information gives me such APIS or not . For example for a site like http://www.sbstransit.com.sg/ i see no APIs for parsing . So how do i go about in this case . This is just an example website .

Try out like ...

 String response = 'json string';
        try {
            JSONArray responseObj= new JSONArray(response);
                 String week_percentage_work = responseObj.getString("key");
             }
        } catch (JSONException e) {
        e.printStackTrace();
    }

More information please visit : android-json-parsing-tutorial

stack question

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM