Page 113 - MDP2022-2
P. 113

@Override
                                    public  void  onClick(View  view)  {
                                            String  data_id  =  id.getText().toString();
                                            String  data_pw  =  pw.getText().toString();
                                            GetData  task  =  new  GetData();
                                            task.execute(data_id,  data_pw);
                                    }
                            });


                            register.setOnClickListener(new  View.OnClickListener()  {
                                    @Override
                                    public  void  onClick(View  view)  {
                                            Intent  intent  =  new  Intent(MainActivity.this,  SubActivity.class);
                                            startActivity(intent);
                                    }
                            });




                    }
                    private  class  GetData  extends  AsyncTask<String,  Void,  String>  {
                            ProgressDialog  progressDialog;
                            String  errorString  =  null;


                            @Override
                            protected  void  onPreExecute()  {
                                    super.onPreExecute();
                                    progressDialog  =  ProgressDialog.show(MainActivity.this,"잠시만  기다려  주세요",  null,  tr
            ue,  true);
                            }


                            @Override
                            protected  String  doInBackground(String...  params)  {
                                    String  serverURL  =  "http://192.168.0.25:8181/android/login.php";
                                    String  postParameters  =  "id="  +  params[0]  +  "&pwd="  +  params[1];
                                    ID  =  params[0];
                                    try  {
                                            URL  url  =  new  URL(serverURL);
                                            HttpURLConnection  httpURLConnection  =  (HttpURLConnection)  url.openConnectio
            n();
                                            httpURLConnection.setReadTimeout(5000);
                                            httpURLConnection.setConnectTimeout(5000);
                                            httpURLConnection.setRequestMethod("POST");
                                            httpURLConnection.setDoInput(true);
                                            httpURLConnection.connect();
   108   109   110   111   112   113   114   115   116   117   118