마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

비동기식 짜는데 문제점이 있는점이 뭔가요

–1 추천
public class regist extends Activity{

    RegBackgroundTask rbgt;

    String ID;
    String PW;
    String NAME;
    String PN;
    String CID;
    int TYPE;
    boolean okreg;
    public List<String> main_items = new ArrayList<String>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.regist);
    }
    public int GetType()    //가입타입받아오기
    {
        RadioGroup rg=(RadioGroup)findViewById(R.id.rb);
        RadioButton rb=(RadioButton)findViewById(rg.getCheckedRadioButtonId());
        String rbt=rb.toString();
        if(rbt.equals("학생"))
        {
            return 1;
        }
        else if(rbt.equals("선생님"))
        {
            return 2;
        }
        else if(rbt.equals("학부모"))
        {
            return 3;
        }
        return 1;
    }

    public void click_stu(View v)   //라디오-학생
    {
        EditText tt=(EditText)findViewById(R.id.childtext);
        tt.setEnabled(false);
        tt.setClickable(false);
        tt.setFocusable(false);
    }
    public void click_pa(View v)    //라디오-부모
    {
        EditText tt=(EditText)findViewById(R.id.childtext);
        tt.setEnabled(true);
        tt.setClickable(true);
        tt.setFocusable(true);
        tt.setFocusableInTouchMode(true);
    }
    public void click_tea(View v)   //라디오-선생
    {
        EditText tt=(EditText)findViewById(R.id.childtext);
        tt.setEnabled(false);
        tt.setClickable(false);
        tt.setFocusable(false);
    }
    public void click_ck(View v)    //중복검사
    {

    }
    public void click_reg(View v)
    {
        EditText id=(EditText)findViewById(R.id.id_text);
        EditText pw=(EditText)findViewById(R.id.pwtext);
        EditText name=(EditText)findViewById(R.id.nametext);
        EditText pn=(EditText)findViewById(R.id.phonetext);
        EditText cid=(EditText)findViewById(R.id.childtext);

        ID=id.getText().toString();
        PW=pw.getText().toString();
        NAME=name.getText().toString();
        PN=pn.getText().toString();
        CID=cid.getText().toString();

        RadioGroup rg=(RadioGroup)findViewById(R.id.rb);
        RadioButton rb=(RadioButton)findViewById(rg.getCheckedRadioButtonId());
        String select=rb.getText().toString();
        EditText ck_pw=(EditText)findViewById(R.id.checkpw);
        TYPE=GetType();

        if(ID==null){
            Toast.makeText(regist.this,"ID 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}
        if(PW==null){ Toast.makeText(regist.this,"비밀번호 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}
        if(NAME==null){Toast.makeText(regist.this,"이름 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}
        if(PN==null){Toast.makeText(regist.this,"전화번호 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}

        String tt=Integer.toString(TYPE);
        rbgt=new RegBackgroundTask();
        rbgt.execute(new String[]{ID,PW,NAME,PN,tt,CID});

        if(okreg==true){ Toast.makeText(regist.this,"가입성공",Toast.LENGTH_SHORT).show(); }
        else{Toast.makeText(regist.this,"실패",Toast.LENGTH_SHORT).show();}

    }

    public class RegBackgroundTask extends AsyncTask<String,String,String>
    {


        protected void onPostExecute()
        {
        }
        @Override
        protected String doInBackground(String...params)
        {
            SoapObject request = new SoapObject("http://tempuri.org/","Join");
            request.addProperty("user_id",params[0]);        //가입시 전달할 아이디
            request.addProperty("pw",params[1]);             //로그인시 전달할 비번
            request.addProperty("name",params[2]);        //가입시 전달할 이름
            request.addProperty("phonnum",params[3]);        //가입시 전달할 전화번호
            request.addProperty("type",Integer.parseInt(params[4]));        //가입시 전달할 가입 타입
            request.addProperty("children_id", params[5]);        //가입시 전달할 자식 아이디


            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
            envelope.setOutputSoapObject(request);
            envelope.dotNet=true;
            HttpTransportSE androidHttpTransport=new HttpTransportSE("http://192.168.33.49:11000/Service");

            try{
                androidHttpTransport.call("http://tempuri.org/IService/Join",envelope);
                Object result=envelope.getResponse();
                String Re=result.toString();
                okreg= Boolean.valueOf(Re).booleanValue();
                return Re;
            }
            catch (Exception e)
            {
                e.printStackTrace();
                return null;
            }

        }
    }
}

으으.... 뭐가 문제일까요 

탄빵 (310 포인트) 님이 2016년 7월 11일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...