Page 93 - 3-2
P. 93

// Safe button click event
                public void onbtn_btnSafeClicked(View view) {
                    // deleting product in background thread
                    Intent intent = new Intent(getApplicationContext(),MainActivity_allproducts.class);
                    Log.d(" 여긴가", "8.11111_delete  로 이동했다 원래화면으로 돌아감");
                    startActivity(intent);;
                    btnSafe.setBackgroundColor(Color.RED);
                    btnSafe.setTextColor(Color.WHITE);
                }




                /*****************************************************************
                 * Background Async Task to Delete Product
                 * */
                class DeleteProduct extends AsyncTask<String, String, String> {
                    private TextView statusField;


                    //flag 0 means get and 1 means post.(By default it is get.)
                    public DeleteProduct(Context context,TextView statusField) {
                        this.statusField = statusField;
                    }


                    /**
                     * Before starting background thread Show Progress Dialog
                     * */
                    @Override
                    protected void onPreExecute() {
                        super.onPreExecute();
                        pDialog = new ProgressDialog(MainActivity_delete.this);
                        pDialog.setMessage("Deleting Product...");
                        pDialog.setIndeterminate(false);
                        pDialog.setCancelable(true);
                        pDialog.show();
                    }


                    /**
                     * Deleting product
                     * */
                    @Override
                    protected String doInBackground(String[] arg0) {


                        // Check for success tag
                        int success;
                        try {
                            String code = (String)arg0[0];


                                                         - 93 -
   88   89   90   91   92   93   94   95   96   97   98