Page 321 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 321

인천전자마이스터고                                                                            전자회로설계과





            }  catch(Exception  e){
            return  null;
            }


            }

            @Override
            protected  void  onPostExecute(String  result){
            myJSON=result;
            showList();
            }
            }
            GetDataJSON  g  =  new  GetDataJSON();
            g.execute(url);
            }


            protected  void  showList(){
            try  {
            JSONObject  jsonObj  =  new  JSONObject(myJSON);    //json  파싱
            eoples  =  jsonObj.getJSONArray(TAG_RESULTS);
            int  i;
            for(i=0;i<peoples.length();i++){
            JSONObject  c  =  peoples.getJSONObject(i);
            String  name  =  c.getString(TAG_NAME);
            String  phone  =  c.getString(TAG_PHONE);
            if(phone.equals(userPhone))
            {
            update(name);  //  회원일경우에만문자전송
            reak;
            }
            }
            if(i==peoples.length())
            Toast.makeText(getApplicationContext(),"등록된회원이아닙니다",Toast.LENGTH_LONG).show();
            }  catch  (JSONException  e)  {
            e.printStackTrace();
            }
            }

            public  void  update(String  name)
            {
            Random  random  =  new  Random();
            int  value  =  random.nextInt(9999);
            String  pw  =  null;
            if(value==0)  pw  =  "0000";
            else  if(value<10)  pw  =  "000"  +  value;
            else  if(value<100)    pw  =  "00"+value;



                                                         -  314  -
   316   317   318   319   320   321   322   323   324   325   326