Skip to content

Instantly share code, notes, and snippets.

@ImUser773
Created May 20, 2017 10:25
Show Gist options
  • Select an option

  • Save ImUser773/7e39df8f9e5a6495901384420c519d96 to your computer and use it in GitHub Desktop.

Select an option

Save ImUser773/7e39df8f9e5a6495901384420c519d96 to your computer and use it in GitHub Desktop.
list_order.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
public boolean onItemLongClick(final AdapterView<?> arg0, View arg1, final int arg2, long arg3) {
AlertDialog.Builder builder = new AlertDialog.Builder(menu.this);
builder.setTitle("ลบเมนูอาหาร");
builder.setMessage("คุณต้องการลบเมนูอาหารใช่หรือไม่?");
builder.setPositiveButton("ใช่", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
addArray.remove(addArray.get(arg2));
list_order.invalidateViews();;
RequestQueue requestQueue = Volley.newRequestQueue(menu.this);
StringRequest request = new StringRequest(Request.Method.POST, URL_DELETE, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d("onResponse", response);
Toast.makeText(getApplicationContext(), "ลบเมนูอาหารเรียบร้อย", Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("onError", error.toString());
Toast.makeText(menu.this, "เกิดข้อผิดพลาดโปรดลองอีกครั้ง", Toast.LENGTH_SHORT).show();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("id_namecustomer", list_order.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
public boolean onItemLongClick(final AdapterView<?> arg0, View arg1, final int arg2, long arg3) {
AlertDialog.Builder builder = new AlertDialog.Builder(menu.this);
builder.setTitle("ลบเมนูอาหาร");
builder.setMessage("คุณต้องการลบเมนูอาหารใช่หรือไม่?");
builder.setPositiveButton("ใช่", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
addArray.remove(addArray.get(arg2));
list_order.invalidateViews();;
RequestQueue requestQueue = Volley.newRequestQueue(menu.this);
StringRequest request = new StringRequest(Request.Method.POST, URL_DELETE, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d("onResponse", response);
Toast.makeText(getApplicationContext(), "ลบเมนูอาหารเรียบร้อย", Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("onError", error.toString());
Toast.makeText(menu.this, "เกิดข้อผิดพลาดโปรดลองอีกครั้ง", Toast.LENGTH_SHORT).show();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("id_namecustomer", idordercustomer[arg2 + 1]);
//params.put("ordercustomerr",ordercustomer);
return params;
}
};
requestQueue.add(request);
}
}););
//params.put("ordercustomerr",ordercustomer);
return params;
}
};
requestQueue.add(request);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment