Page 793 - 3-2
P. 793

String line = null;


                                // Read Server Response
                                while ((line = reader.readLine()) != null) {
                                    sb.append(line);
                                    break;
                                }
                                return sb.toString();
                            } catch (Exception e) {
                                return new String("Exception: " + e.getMessage());
                            }
                        }
                    }
                    InsertData task = new InsertData();
                    task.execute(umbrella_num);
                }


                private void rent_db(String rent_num) {
                    class InsertData extends AsyncTask<String, Void, String> {
                        ProgressDialog loading;
                        @Override
                        protected void onPreExecute() {
                            super.onPreExecute();
                            loading = ProgressDialog.show(RentActivity.this, "Please Wait", null, true, true);
                        }
                        @Override
                        protected void onPostExecute(String s) {
                            super.onPostExecute(s);
                            loading.dismiss();
                            Toast.makeText(getApplicationContext(), s, Toast.LENGTH_LONG).show();
                        }
                        @Override
                        protected String doInBackground(String... params) {


                            try {
                                String num = (String) params[0];


                                String link = "http://192.168.0.77/rent_num_db.php";
                                String  data   =   URLEncoder.encode("rent_num",     "UTF-8")    +   "="   +
            URLEncoder.encode(num, "UTF-8");


                                URL url = new URL(link);
                                URLConnection conn = url.openConnection();




                                                         - 793 -
   788   789   790   791   792   793   794   795   796   797   798