티스토리 뷰

SWDesk/App

[Android] JSON String from Web

inhae 2021. 10. 9. 10:53

 

                if(HttpResponseString == null) return;
                JSONObject jsonObject = null;
                try {
                    jsonObject = new JSONObject(HttpResponseString);
                    if(jsonObject.has("Message")){
                        ShowResponseMessage(jsonObject.getString("Message"));
                        return;
                    }
                }catch(Exception e){
                    Log.d("[??? HttpResponseString]", HttpResponseString);
                }
                switch(HttpRequestType){
                    case REQUEST_USERINFO:
                        HttpRequestType = REQUEST_NONE;
                        try{
                            LoginInfo = jsonObject;
                            JSONArray modelList = LoginInfo.getJSONArray("ModelData");
                            for(int index1=0; index1<modelList.length(); index1++){
                                JSONObject model0 = modelList.getJSONObject(0);
                                ModelList.add(model0);
                                ModelNameList.add(model0.getString("ModelName"));
                            }
                            JSONObject userInfo = LoginInfo.getJSONObject("UserInfo");
                            String eDate = userInfo.getString("E_Date");
                            if(!CheckExpireDate(eDate)){
                                openSimpleAlertDialogOnUiThread("[Notice]", "Subscription Expired");
                                //IsExpired = true;
                                return;
                            }

 

반응형

'SWDesk > App' 카테고리의 다른 글

Testing WebAccess  (0) 2021.11.16
RecyclerVieiwTest02  (0) 2021.11.06
[Android] Spinner Example  (0) 2021.08.29
[Android] HTTP POST Request  (0) 2021.08.22
[Android] Displaying AlertDialog  (0) 2021.08.14