Member-only story
Remove items from RecyclerView
To remove the verified OTP complaint from the RecyclerView, you can directly remove the corresponding item from the adapter’s data list and notify the adapter. Here’s the updated code with that logic integrated:
Let’s Take an example for an OTP inside
RecyclerViewAdapter
private void verify_OTP(String compNo, String serStationCode, String otp, String rating, String feed, String close_by_emp, String contactPhone) {
final ProgressDialog loading = ProgressDialog.show(context, “Verifying”, “Please wait…”, false, false);
StringRequest stringRequest = new StringRequest(Request.Method.POST, electrical_verify_OTP_technician,
response -> {
loading.dismiss();
Log.d(“verify_OTP-”, “Response: “ + response);
try {
JSONObject jsonResponse = new JSONObject(response);
int msg = jsonResponse.optInt(“success”, 0);
String serverMessage = jsonResponse.optString(“message”, “Unknown response from server”);
if (msg == 1) {
// Remove the verified complaint from the list
for (int i = 0; i < getDataAdapter.size(); i++) {