Member-only story

Remove items from RecyclerView

www.jyotishgher.in
2 min readFeb 5, 2025

--

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:

Remove items from RecyclerView
Remove items from RecyclerView

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++) {

--

--

www.jyotishgher.in
www.jyotishgher.in

Written by www.jyotishgher.in

Jyotishgher is a premier "Astrology as a Service" startup that redefines how astrology is practiced, learned, and applied. Jyotishgher is your trusted platform.

No responses yet