Page 866 - 3-3
P. 866
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_schedule);
list = (ListView) findViewById(R.id.listView);
// listView 클릭 불가능
list.setSelector(R.drawable.selector);
// 홈 아이콘 표시
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Intent receivedIntent = getIntent(); // 인탠트 생성
// name 변수에 "name" 에서 받아온 Extra 정보를 받아옴
String name = receivedIntent.getExtras().getString("name");
// IP 변수에 "IP" 에서 받아온 Extra 정보를 받아옴
final String IP = receivedIntent.getStringExtra("IP");
// WebIP 변수에 "WebIP" 에서 받아온 Extra 정보를 받아옴
final String WebIP = receivedIntent.getStringExtra("WebIP");
// PORT 변수에 "PORT" 에서 받아온 Extra 정보를 받아옴
final int PORT = receivedIntent.getIntExtra("PORT",1);
personList = new ArrayList<HashMap<String, String>>();
// 선생님 이름에 따라 시간표를 받아옴
if (name.equals(" 이두희")) {
getData("http://" + WebIP + "/project/smart-office/android/ldhschedule.php");
} else if (name.equals(" 윤상종")) {
getData2("http://" + WebIP + "/project/smart-office/android/ysjschedule.php");
} else if (name.equals(" 김진섭")) {
getData3("http://" + WebIP + "/project/smart-office/android/kjsschedule.php");
} else if (name.equals(" 최윤희")) {
getData4("http://" + WebIP + "/project/smart-office/android/cyhschedule.php");
}
}
// JSON 파싱
protected void showList() {
try {
JSONObject jsonObj = new JSONObject(myJSON);// JSON 생성
peoples = jsonObj.getJSONArray(TAG_JSON);// TAG_JSON 값과 일치하는 DB 값을 불러
옴
for (int i = 0; i < peoples.length(); i++) {
JSONObject c = peoples.getJSONObject(i);
String period = c.getString(TAG_PERIOD);// TAG_PERIOD 값을 period 에 저장
String mon = c.getString(TAG_MON); // TAG_MON 값을 mon 에 저장
String tue = c.getString(TAG_TUE); // TAG_TUE 값을 tue 에 저장
String wed = c.getString(TAG_WED); // TAG_WED 값을 wed 에 저장
String thu = c.getString(TAG_THU); // TAG_THU 값을 thu 에 저장
String fri = c.getString(TAG_FRI); // TAG_FRI 값을 fri 에 저장
HashMap<String, String> persons = new HashMap<String, String>();
- 866 -