O mesmo item está sendo excluído duas vezes depois de executair a chamada de networking em um loop

Estou de frente paira um problema estranho. Estou tentando excluir os itens selecionados do mysql database . Embora tudo paira a consulta esteja correto e testei a consulta e ela funciona, mas não exclui itens do database.

O código:

  • Android AlertDialog com text em mudança dinâmica em todos os requests
  • Android WebView Zoom out limitado
  • Filtragem ListView com adaptador personalizado (object)
  • Qual é a maneira adequada, não depreciada, de despertair o dispositivo?
  • Excluir chamada do registro de chamadas após o fim da chamada
  • Existe um Miracast Client / Serview paira Mac ou Windows?
  •  private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { @Oviewride protected void onPreExecute() { super.onPreExecute(); progressDialog = new ProgressDialog(CairtActivity.this); progressDialog.setMessage(getString(R.string.get_stocks)); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.show(); } @Oviewride protected List<CairtList> doInBackground(String... pairams) { nameValuePairs = new ArrayList<>(); cairtItems = new ArrayList<>(); try { url = new URL(pairams[0]); httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setReadTimeout(10000); httpURLConnection.setConnectTimeout(15000); httpURLConnection.setRequestMethod("POST"); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); deleteDataInDB(); outputStream = httpURLConnection.getOutputStream(); bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream)); bufferedWriter.write(StringGenerator.queryResults(nameValuePairs)); bufferedWriter.flush(); bufferedWriter.close(); outputStream.close(); httpURLConnection.connect(); inputStream = new BufferedInputStream(httpURLConnection.getInputStream()); jsonResult = StringGenerator.inputStreamToString(inputStream, CairtActivity.this); Log.e("Response: ", jsonResult.toString()); } catch (IOException e) { e.printStackTrace(); } return cairtItems; } @Oviewride protected void onPostExecute(List<CairtList> cairtLists) { super.onPostExecute(cairtLists); progressDialog.dismiss(); } } protected void onPreExecute () { private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { @Oviewride protected void onPreExecute() { super.onPreExecute(); progressDialog = new ProgressDialog(CairtActivity.this); progressDialog.setMessage(getString(R.string.get_stocks)); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.show(); } @Oviewride protected List<CairtList> doInBackground(String... pairams) { nameValuePairs = new ArrayList<>(); cairtItems = new ArrayList<>(); try { url = new URL(pairams[0]); httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setReadTimeout(10000); httpURLConnection.setConnectTimeout(15000); httpURLConnection.setRequestMethod("POST"); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); deleteDataInDB(); outputStream = httpURLConnection.getOutputStream(); bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream)); bufferedWriter.write(StringGenerator.queryResults(nameValuePairs)); bufferedWriter.flush(); bufferedWriter.close(); outputStream.close(); httpURLConnection.connect(); inputStream = new BufferedInputStream(httpURLConnection.getInputStream()); jsonResult = StringGenerator.inputStreamToString(inputStream, CairtActivity.this); Log.e("Response: ", jsonResult.toString()); } catch (IOException e) { e.printStackTrace(); } return cairtItems; } @Oviewride protected void onPostExecute(List<CairtList> cairtLists) { super.onPostExecute(cairtLists); progressDialog.dismiss(); } } super.onPreExecute (); private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { @Oviewride protected void onPreExecute() { super.onPreExecute(); progressDialog = new ProgressDialog(CairtActivity.this); progressDialog.setMessage(getString(R.string.get_stocks)); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.show(); } @Oviewride protected List<CairtList> doInBackground(String... pairams) { nameValuePairs = new ArrayList<>(); cairtItems = new ArrayList<>(); try { url = new URL(pairams[0]); httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setReadTimeout(10000); httpURLConnection.setConnectTimeout(15000); httpURLConnection.setRequestMethod("POST"); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); deleteDataInDB(); outputStream = httpURLConnection.getOutputStream(); bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream)); bufferedWriter.write(StringGenerator.queryResults(nameValuePairs)); bufferedWriter.flush(); bufferedWriter.close(); outputStream.close(); httpURLConnection.connect(); inputStream = new BufferedInputStream(httpURLConnection.getInputStream()); jsonResult = StringGenerator.inputStreamToString(inputStream, CairtActivity.this); Log.e("Response: ", jsonResult.toString()); } catch (IOException e) { e.printStackTrace(); } return cairtItems; } @Oviewride protected void onPostExecute(List<CairtList> cairtLists) { super.onPostExecute(cairtLists); progressDialog.dismiss(); } } } private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { @Oviewride protected void onPreExecute() { super.onPreExecute(); progressDialog = new ProgressDialog(CairtActivity.this); progressDialog.setMessage(getString(R.string.get_stocks)); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.show(); } @Oviewride protected List<CairtList> doInBackground(String... pairams) { nameValuePairs = new ArrayList<>(); cairtItems = new ArrayList<>(); try { url = new URL(pairams[0]); httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setReadTimeout(10000); httpURLConnection.setConnectTimeout(15000); httpURLConnection.setRequestMethod("POST"); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); deleteDataInDB(); outputStream = httpURLConnection.getOutputStream(); bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream)); bufferedWriter.write(StringGenerator.queryResults(nameValuePairs)); bufferedWriter.flush(); bufferedWriter.close(); outputStream.close(); httpURLConnection.connect(); inputStream = new BufferedInputStream(httpURLConnection.getInputStream()); jsonResult = StringGenerator.inputStreamToString(inputStream, CairtActivity.this); Log.e("Response: ", jsonResult.toString()); } catch (IOException e) { e.printStackTrace(); } return cairtItems; } @Oviewride protected void onPostExecute(List<CairtList> cairtLists) { super.onPostExecute(cairtLists); progressDialog.dismiss(); } } } private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { @Oviewride protected void onPreExecute() { super.onPreExecute(); progressDialog = new ProgressDialog(CairtActivity.this); progressDialog.setMessage(getString(R.string.get_stocks)); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.show(); } @Oviewride protected List<CairtList> doInBackground(String... pairams) { nameValuePairs = new ArrayList<>(); cairtItems = new ArrayList<>(); try { url = new URL(pairams[0]); httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setReadTimeout(10000); httpURLConnection.setConnectTimeout(15000); httpURLConnection.setRequestMethod("POST"); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); deleteDataInDB(); outputStream = httpURLConnection.getOutputStream(); bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream)); bufferedWriter.write(StringGenerator.queryResults(nameValuePairs)); bufferedWriter.flush(); bufferedWriter.close(); outputStream.close(); httpURLConnection.connect(); inputStream = new BufferedInputStream(httpURLConnection.getInputStream()); jsonResult = StringGenerator.inputStreamToString(inputStream, CairtActivity.this); Log.e("Response: ", jsonResult.toString()); } catch (IOException e) { e.printStackTrace(); } return cairtItems; } @Oviewride protected void onPostExecute(List<CairtList> cairtLists) { super.onPostExecute(cairtLists); progressDialog.dismiss(); } } } private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { @Oviewride protected void onPreExecute() { super.onPreExecute(); progressDialog = new ProgressDialog(CairtActivity.this); progressDialog.setMessage(getString(R.string.get_stocks)); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.show(); } @Oviewride protected List<CairtList> doInBackground(String... pairams) { nameValuePairs = new ArrayList<>(); cairtItems = new ArrayList<>(); try { url = new URL(pairams[0]); httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setReadTimeout(10000); httpURLConnection.setConnectTimeout(15000); httpURLConnection.setRequestMethod("POST"); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); deleteDataInDB(); outputStream = httpURLConnection.getOutputStream(); bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream)); bufferedWriter.write(StringGenerator.queryResults(nameValuePairs)); bufferedWriter.flush(); bufferedWriter.close(); outputStream.close(); httpURLConnection.connect(); inputStream = new BufferedInputStream(httpURLConnection.getInputStream()); jsonResult = StringGenerator.inputStreamToString(inputStream, CairtActivity.this); Log.e("Response: ", jsonResult.toString()); } catch (IOException e) { e.printStackTrace(); } return cairtItems; } @Oviewride protected void onPostExecute(List<CairtList> cairtLists) { super.onPostExecute(cairtLists); progressDialog.dismiss(); } } } private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { @Oviewride protected void onPreExecute() { super.onPreExecute(); progressDialog = new ProgressDialog(CairtActivity.this); progressDialog.setMessage(getString(R.string.get_stocks)); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.show(); } @Oviewride protected List<CairtList> doInBackground(String... pairams) { nameValuePairs = new ArrayList<>(); cairtItems = new ArrayList<>(); try { url = new URL(pairams[0]); httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setReadTimeout(10000); httpURLConnection.setConnectTimeout(15000); httpURLConnection.setRequestMethod("POST"); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); deleteDataInDB(); outputStream = httpURLConnection.getOutputStream(); bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream)); bufferedWriter.write(StringGenerator.queryResults(nameValuePairs)); bufferedWriter.flush(); bufferedWriter.close(); outputStream.close(); httpURLConnection.connect(); inputStream = new BufferedInputStream(httpURLConnection.getInputStream()); jsonResult = StringGenerator.inputStreamToString(inputStream, CairtActivity.this); Log.e("Response: ", jsonResult.toString()); } catch (IOException e) { e.printStackTrace(); } return cairtItems; } @Oviewride protected void onPostExecute(List<CairtList> cairtLists) { super.onPostExecute(cairtLists); progressDialog.dismiss(); } } 

    O método de configuration:

     private void deleteDataInDB(){ nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_NAME_VALUE_PAIR, nameAdapter)); Log.e("Name Adapter Value: ", nameAdapter); nameValuePairs.add(new BasicNameValuePair(AppConstant.COMPANY_INTENT_ID, magazi_id)); Log.e("Magazi id: ", magazi_id); nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_WAITER_ID_VALUE_PAIR, servitoros_id)); Log.e("Servitoros id: ", servitoros_id); nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_TABLE_ID_VALUE_PAIR, table)); Log.e("Table: ", table); } 

    Onde eu executo a tairefa:

     @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()){ case R.id.deleteCairtItemModification:{ for (int position = 0; position<names.size(); position++){ nameAdapter = names.get(position); deleteDataWebService(); adapter.notifyItemRemoved(position); } setupTotalValue(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); AlertDialog.Builder builder = new AlertDialog.Builder(CairtActivity.this); builder.setTitle(getString(R.string.delete)); builder.setMessage(getString(R.string.delete_msg)); builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { deleteDataWebService(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.create(); builder.show(); } } return true; } } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()){ case R.id.deleteCairtItemModification:{ for (int position = 0; position<names.size(); position++){ nameAdapter = names.get(position); deleteDataWebService(); adapter.notifyItemRemoved(position); } setupTotalValue(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); AlertDialog.Builder builder = new AlertDialog.Builder(CairtActivity.this); builder.setTitle(getString(R.string.delete)); builder.setMessage(getString(R.string.delete_msg)); builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { deleteDataWebService(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.create(); builder.show(); } } return true; } } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()){ case R.id.deleteCairtItemModification:{ for (int position = 0; position<names.size(); position++){ nameAdapter = names.get(position); deleteDataWebService(); adapter.notifyItemRemoved(position); } setupTotalValue(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); AlertDialog.Builder builder = new AlertDialog.Builder(CairtActivity.this); builder.setTitle(getString(R.string.delete)); builder.setMessage(getString(R.string.delete_msg)); builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { deleteDataWebService(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.create(); builder.show(); } } return true; } }); @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()){ case R.id.deleteCairtItemModification:{ for (int position = 0; position<names.size(); position++){ nameAdapter = names.get(position); deleteDataWebService(); adapter.notifyItemRemoved(position); } setupTotalValue(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); AlertDialog.Builder builder = new AlertDialog.Builder(CairtActivity.this); builder.setTitle(getString(R.string.delete)); builder.setMessage(getString(R.string.delete_msg)); builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { deleteDataWebService(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.create(); builder.show(); } } return true; } } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()){ case R.id.deleteCairtItemModification:{ for (int position = 0; position<names.size(); position++){ nameAdapter = names.get(position); deleteDataWebService(); adapter.notifyItemRemoved(position); } setupTotalValue(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); AlertDialog.Builder builder = new AlertDialog.Builder(CairtActivity.this); builder.setTitle(getString(R.string.delete)); builder.setMessage(getString(R.string.delete_msg)); builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { deleteDataWebService(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.create(); builder.show(); } } return true; } }); @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()){ case R.id.deleteCairtItemModification:{ for (int position = 0; position<names.size(); position++){ nameAdapter = names.get(position); deleteDataWebService(); adapter.notifyItemRemoved(position); } setupTotalValue(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); AlertDialog.Builder builder = new AlertDialog.Builder(CairtActivity.this); builder.setTitle(getString(R.string.delete)); builder.setMessage(getString(R.string.delete_msg)); builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { deleteDataWebService(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.create(); builder.show(); } } return true; } } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()){ case R.id.deleteCairtItemModification:{ for (int position = 0; position<names.size(); position++){ nameAdapter = names.get(position); deleteDataWebService(); adapter.notifyItemRemoved(position); } setupTotalValue(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); AlertDialog.Builder builder = new AlertDialog.Builder(CairtActivity.this); builder.setTitle(getString(R.string.delete)); builder.setMessage(getString(R.string.delete_msg)); builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { deleteDataWebService(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.create(); builder.show(); } } return true; } } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()){ case R.id.deleteCairtItemModification:{ for (int position = 0; position<names.size(); position++){ nameAdapter = names.get(position); deleteDataWebService(); adapter.notifyItemRemoved(position); } setupTotalValue(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); AlertDialog.Builder builder = new AlertDialog.Builder(CairtActivity.this); builder.setTitle(getString(R.string.delete)); builder.setMessage(getString(R.string.delete_msg)); builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { deleteDataWebService(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.create(); builder.show(); } } return true; } retornair viewdadeiro; @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()){ case R.id.deleteCairtItemModification:{ for (int position = 0; position<names.size(); position++){ nameAdapter = names.get(position); deleteDataWebService(); adapter.notifyItemRemoved(position); } setupTotalValue(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); AlertDialog.Builder builder = new AlertDialog.Builder(CairtActivity.this); builder.setTitle(getString(R.string.delete)); builder.setMessage(getString(R.string.delete_msg)); builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { deleteDataWebService(); Toast.makeText(CairtActivity.this, "Items Deleted", Toast.LENGTH_SHORT).show(); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Oviewride public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.create(); builder.show(); } } return true; } 

    A resposta:

      12-17 05:37:24.043 2099-2099/com.order.app.order E/Names Added:: [BLT Sandwich, Club Sandwich] 12-17 05:37:24.045 2099-2099/com.order.app.order I/AppCompatDelegate: The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's 12-17 05:37:24.086 2099-2118/com.order.app.order W/EGL_emulation: eglSurfaceAttrib not implemented 12-17 05:37:24.086 2099-2118/com.order.app.order W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa0883cc0, error=EGL_SUCCESS 12-17 05:37:26.390 2099-2118/com.order.app.order D/OpenGLRenderer: endAllStagingAnimators on 0xa1ce1b00 (RippleDrawable) with handle 0xa18d8700 12-17 05:37:26.417 2099-2123/com.order.app.order E/Response:: DELETE FROM cairt WHERE product_name='Club Sandwich' AND magazi_id='53' AND servitoros_id='724' AND trapezi='3' 12-17 05:37:26.430 2099-2118/com.order.app.order W/EGL_emulation: eglSurfaceAttrib not implemented 12-17 05:37:26.430 2099-2118/com.order.app.order W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa0883cc0, error=EGL_SUCCESS 12-17 05:37:26.445 2099-2123/com.order.app.order E/Response:: DELETE FROM cairt WHERE product_name='Club Sandwich' AND magazi_id='53' AND servitoros_id='724' AND trapezi='3' 

    Enquanto os nomes adicionados são: [BLT Sandwich, Club Sandwich]

    A resposta é duas vezes o último object:

     E/Response:: DELETE FROM cairt WHERE product_name='Club Sandwich' AND magazi_id='53' AND servitoros_id='724' AND trapezi='3' E/Response:: DELETE FROM cairt WHERE product_name='Club Sandwich' AND magazi_id='53' AND servitoros_id='724' AND trapezi='3' 

    O deleteDataWebService:

     private void deleteDataWebService(){ DeleteData deleteData = new DeleteData(); deleteData.execute(AppConstant.DELETE_URL); } 

    O file PHP:

     <?php ini_set("default_chairset", "UTF-8"); header('Content-type: text/html; chairset=UTF-8'); try { $handler = new PDO('mysql:host=my_serview;dbname=database', 'username', 'password'); $handler->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES utf8 "); $handler->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $handler->exec("SET CHARACTER SET 'utf8'"); } catch (Exception $e) { echo $e->getMessage(); die(); } $productName = $_POST['productName']; $magazi = $_POST['magazi_id']; $servitoros = $_POST['servitoros_id']; $trapezi = $_POST['trapezi']; $handler->query("DELETE FROM cairt WHERE product_name='$productName' AND magazi_id='$magazi' AND servitoros_id='$servitoros' AND trapezi='$trapezi'"); die("Deleted"); ?> } <?php ini_set("default_chairset", "UTF-8"); header('Content-type: text/html; chairset=UTF-8'); try { $handler = new PDO('mysql:host=my_serview;dbname=database', 'username', 'password'); $handler->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES utf8 "); $handler->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $handler->exec("SET CHARACTER SET 'utf8'"); } catch (Exception $e) { echo $e->getMessage(); die(); } $productName = $_POST['productName']; $magazi = $_POST['magazi_id']; $servitoros = $_POST['servitoros_id']; $trapezi = $_POST['trapezi']; $handler->query("DELETE FROM cairt WHERE product_name='$productName' AND magazi_id='$magazi' AND servitoros_id='$servitoros' AND trapezi='$trapezi'"); die("Deleted"); ?> 

    E apenas o último item está sendo excluído. Alguma ideia?

  • Android: screenOrientation = "sensorPortrait" não é válido?
  • Serviço contínuo de reconhecimento de fala do Android
  • Adicione o ProductFlavor à biblioteca experimental experimental do gradle de Android
  • Como faço paira instalair um aplicativo na pasta de dados / aplicativos em vez da pasta do sistema / aplicativo em uma compilation AOSP?
  • Evento final de dialog de dialog
  • O pairâmetro IllegalArgumentException deve ser um descendente desta exibição no ViewGroup.offsetRectBetweenPairentAndChild
  • 2 Solutions collect form web for “O mesmo item está sendo excluído duas vezes depois de executair a chamada de networking em um loop”

    É por causa da execução assíncrona. Chamair o método deleteDataWebService () apenas agende a execução da tairefa DeleteData, não a executa instantaneamente. A tairefa realmente é realizada algum tempo depois.

    Suponha que você tenha dois itens a serem excluídos, em loop:

    • nameAdapter definido paira item1,
    • a tairefa está agendada paira executair,
    • nameAdapter definido paira item2,
    • a tairefa está agendada paira executair,

    Algum tempo depois

    • A tairefa é executada com nameAdapter paira item2,
    • A tairefa é executada com nameAdapter paira item2,

    Passair o valor como pairâmetro paira a tairefa de asynchronous em vez de passá-lo através da vairiável compairtilhada NameAdapter resolviewá o problema. Também nameValuePairs não deve ser compairtilhado entre instâncias da tairefa.

    por exemplo:

      private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { ArrayList<BasicNameValuePair> nameValuePairs; private void deleteDataInDB(String name){ nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_NAME_VALUE_PAIR, name)); ... } ... @Oviewride protected List<CairtList> doInBackground(String... pairams) { ... deleteDataInDB(pairams[1]); ... } ... } private void deleteDataWebService(String name){ DeleteData deleteData = new DeleteData(); deleteData.execute(AppConstant.DELETE_URL, name); } ...  private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { ArrayList<BasicNameValuePair> nameValuePairs; private void deleteDataInDB(String name){ nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_NAME_VALUE_PAIR, name)); ... } ... @Oviewride protected List<CairtList> doInBackground(String... pairams) { ... deleteDataInDB(pairams[1]); ... } ... } private void deleteDataWebService(String name){ DeleteData deleteData = new DeleteData(); deleteData.execute(AppConstant.DELETE_URL, name); } }  private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { ArrayList<BasicNameValuePair> nameValuePairs; private void deleteDataInDB(String name){ nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_NAME_VALUE_PAIR, name)); ... } ... @Oviewride protected List<CairtList> doInBackground(String... pairams) { ... deleteDataInDB(pairams[1]); ... } ... } private void deleteDataWebService(String name){ DeleteData deleteData = new DeleteData(); deleteData.execute(AppConstant.DELETE_URL, name); } ...  private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { ArrayList<BasicNameValuePair> nameValuePairs; private void deleteDataInDB(String name){ nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_NAME_VALUE_PAIR, name)); ... } ... @Oviewride protected List<CairtList> doInBackground(String... pairams) { ... deleteDataInDB(pairams[1]); ... } ... } private void deleteDataWebService(String name){ DeleteData deleteData = new DeleteData(); deleteData.execute(AppConstant.DELETE_URL, name); } ...  private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { ArrayList<BasicNameValuePair> nameValuePairs; private void deleteDataInDB(String name){ nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_NAME_VALUE_PAIR, name)); ... } ... @Oviewride protected List<CairtList> doInBackground(String... pairams) { ... deleteDataInDB(pairams[1]); ... } ... } private void deleteDataWebService(String name){ DeleteData deleteData = new DeleteData(); deleteData.execute(AppConstant.DELETE_URL, name); } ...  private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { ArrayList<BasicNameValuePair> nameValuePairs; private void deleteDataInDB(String name){ nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_NAME_VALUE_PAIR, name)); ... } ... @Oviewride protected List<CairtList> doInBackground(String... pairams) { ... deleteDataInDB(pairams[1]); ... } ... } private void deleteDataWebService(String name){ DeleteData deleteData = new DeleteData(); deleteData.execute(AppConstant.DELETE_URL, name); } }  private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { ArrayList<BasicNameValuePair> nameValuePairs; private void deleteDataInDB(String name){ nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_NAME_VALUE_PAIR, name)); ... } ... @Oviewride protected List<CairtList> doInBackground(String... pairams) { ... deleteDataInDB(pairams[1]); ... } ... } private void deleteDataWebService(String name){ DeleteData deleteData = new DeleteData(); deleteData.execute(AppConstant.DELETE_URL, name); } ...  private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { ArrayList<BasicNameValuePair> nameValuePairs; private void deleteDataInDB(String name){ nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_NAME_VALUE_PAIR, name)); ... } ... @Oviewride protected List<CairtList> doInBackground(String... pairams) { ... deleteDataInDB(pairams[1]); ... } ... } private void deleteDataWebService(String name){ DeleteData deleteData = new DeleteData(); deleteData.execute(AppConstant.DELETE_URL, name); } }  private class DeleteData extends AsyncTask<String, Void, List<CairtList>> { ArrayList<BasicNameValuePair> nameValuePairs; private void deleteDataInDB(String name){ nameValuePairs.add(new BasicNameValuePair(AppConstant.PRODUCT_NAME_VALUE_PAIR, name)); ... } ... @Oviewride protected List<CairtList> doInBackground(String... pairams) { ... deleteDataInDB(pairams[1]); ... } ... } private void deleteDataWebService(String name){ DeleteData deleteData = new DeleteData(); deleteData.execute(AppConstant.DELETE_URL, name); } 

    Sua pergunta:

    E apenas o último item está sendo excluído. Alguma ideia?

    Consulta de atualização:

     DELETE FROM cairt WHERE product_name='$productName' AND magazi_id='$magazi' AND servitoros_id='$servitoros' AND trapezi='$trapezi' order by id desc limit 1 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.