Page 501 - 3-3
P. 501

JSONObject item = jsonArray.getJSONObject(0);
                          String floor = item.getString(TAG_FLOOR);
                          textFloor.setText(floor);
                      } catch (JSONException e) {
                          Log.d("Error", e.toString());
                          Toast.makeText(this, " 층 정보 로딩 실패", Toast.LENGTH_SHORT).show();
                      }
                  }
              }


               엘리베이터의 wifi      와 웹서버를 연결하는 소스이다.
                  마. ElevatorLogActivity


              package com.example.jbtc_01_06.outside.Elevator;


              import android.content.Intent;
              import android.content.SharedPreferences;
              import android.os.AsyncTask;
              import android.support.v7.app.AppCompatActivity;
              import android.os.Bundle;
              import android.util.Log;
              import android.widget.ListAdapter;
              import android.widget.ListView;
              import android.widget.SimpleAdapter;
              import android.widget.Toast;


              import com.example.jbtc_01_06.outside.R;


              import org.json.JSONArray;
              import org.json.JSONException;
              import org.json.JSONObject;


              import java.io.BufferedReader;
              import java.io.InputStreamReader;
              import java.net.HttpURLConnection;
              import java.net.URL;
              import java.util.ArrayList;
              import java.util.HashMap;


              public class ElevatorLogActivity extends AppCompatActivity {
                  private ListView listLog;


                  private static final String TAG_JSON = "EventLog";
                  private static final String TAG_NUMBER = "Number";
                  private static final String TAG_EVENT = "Event";


                                                          - 501 -
   496   497   498   499   500   501   502   503   504   505   506