简体   繁体   English

在Android App中解析来自互联网的数据

[英]Parsing data from internet in a Android App

Hey folks so here i am starting out with a few baby steps in Android Programming . 大家好,在这里,我从Android编程的几个小步骤开始。 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 . 我看到的示例使用JSON解析来解析来自Internet的数据,特别是twitter。 So how do i check if the website that i want to pull in information gives me such APIS or not . 因此,如何检查我要获取信息的网站是否提供了此类APIS。 For example for a site like http://www.sbstransit.com.sg/ i see no APIs for parsing . 例如,对于http://www.sbstransit.com.sg/这样的网站,我看不到任何用于解析的API。 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 更多信息请访问: android-json-parsing-tutorial

stack question 堆栈问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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