Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private class ParseTask extends AsyncTask<Void, Void, String> {
- //
- // HttpURLConnection urlConnection = null;
- // BufferedReader reader = null;
- // String resultJson = "";
- //
- // @Override
- // protected String doInBackground(Void... params) {
- // // получаем данные с внешнего ресурса
- // try {
- // URL url = new URL("http://ellotv.bigdig.com.ua/api/home/video");
- //
- // urlConnection = (HttpURLConnection) url.openConnection();
- // urlConnection.setRequestMethod("GET");
- // urlConnection.connect();
- //
- // InputStream inputStream = urlConnection.getInputStream();
- // StringBuffer buffer = new StringBuffer();
- //
- // reader = new BufferedReader(new InputStreamReader(inputStream));
- //
- // String line;
- // while ((line = reader.readLine()) != null) {
- // buffer.append(line);
- // }
- //
- // resultJson = buffer.toString();
- //
- // } catch (Exception e) {
- // e.printStackTrace();
- // }
- // return resultJson;
- // }
- //
- // @Override
- // protected void onPostExecute(String strJson) {
- // super.onPostExecute(strJson);
- // // выводим целиком полученную json-строку
- // Log.d(LOG_TAG, strJson);
- //
- // JSONObject dataJsonObj = null;
- // String id = "";
- //
- // try {
- // dataJsonObj = new JSONObject(strJson);
- // JSONArray items = dataJsonObj.getJSONArray("items");
- //
- // // 1. достаем инфо
- // JSONObject firstpole = items.getJSONObject(1597);
- // id = firstpole.getString("id");
- // Log.d(LOG_TAG, "id: " + id);
- //
- // // 2. перебираем и выводим
- // for (int i = 0; i < items.length(); i++) {
- // JSONObject item = items.getJSONObject(i);
- //
- // JSONObject pole = item.getJSONObject("items");
- //
- // String picture = pole.getString("picture");
- // String title = pole.getString("title");
- // String artist = pole.getString("artist");
- // String view_count = pole.getString("view_count");
- //
- // Log.d(LOG_TAG, "picture" + picture);
- // Log.d(LOG_TAG, "title: " + title);
- // Log.d(LOG_TAG, "artist: " + artist);
- // Log.d(LOG_TAG, "view_count: " + view_count);
- // }
- //
- // } catch (JSONException e) {
- // e.printStackTrace();
- // }
- // }
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement