Pictures of the link in the user name and password to login. Because the Json need to read the data. It is with Android, how do I do that ?
@Override protected String doInBackground(String... urls) {
return GET(urls[0]);
}
@Override protected void onPostExecute(String result) {
if(result == null) {
progress.show();
Log.i("Arduino Server ", "[ Server Bağlantısı Kuruluyor ]");
} else {
progress.dismiss();
Log.i("Arduino Server ", "[ Server Bağlantısı Kuruldu ]");
}
try {
JSONObject json = new JSONObject(result);
outlet10 = json.getString("outlet10").toString();
outlet11 = json.getString("outlet11").toString();
outlet12 = json.getString("outlet12").toString();
outlet13 = json.getString("outlet13").toString();
outlet14 = json.getString("outlet14").toString();
outlet15 = json.getString("outlet15").toString();
if (outlet10.equals("on")) { Switch1.setChecked(true); }else{ Switch1.setChecked(false); }
if (outlet11.equals("on")) { Switch2.setChecked(true); }else{ Switch2.setChecked(false); }
if (outlet12.equals("on")) { Switch3.setChecked(true); }else{ Switch3.setChecked(false); }
if (outlet13.equals("on")) { Switch4.setChecked(true); }else{ Switch4.setChecked(false); }
if (outlet14.equals("on")) { Switch5.setChecked(true); }else{ Switch5.setChecked(false); }
if (outlet15.equals("on")) { Switch6.setChecked(true); }else{ Switch6.setChecked(false); }
} catch (JSONException e) {
e.printStackTrace();
}
Log.i("Json Durumlar ", "Alındı...");
}
}
Bu linkteki örneğe bakabilir misin? yardımcı olabilir
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.