Unblock A Number On Android [top] May 2026

private void loadBlockedNumbers() { blockedNumbersList = blockedNumbersManager.getBlockedNumbers(); adapter.setData(blockedNumbersList); }

<androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent"/> </LinearLayout> - List item layout <?xml version="1.0" encoding="utf-8"?> <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="4dp" app:cardCornerRadius="8dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp"> <TextView android:id="@+id/tvNumber" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="18sp" android:textStyle="bold" android:textColor="#000000"/> <TextView android:id="@+id/tvName" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="#666666" android:layout_marginTop="4dp"/> <TextView android:id="@+id/tvBlockedDate" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="12sp" android:textColor="#999999" android:layout_marginTop="4dp"/> <Button android:id="@+id/btnUnblock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Unblock" android:layout_marginTop="8dp" style="?attr/materialButtonOutlinedStyle"/> </LinearLayout> </androidx.cardview.widget.CardView> 7. Optional: Add quick unblock from call log (CallLogHelper.java) public class CallLogHelper { public static void addUnblockButtonToCallLog(Context context, String phoneNumber) { // This can be integrated into your call log adapter new AlertDialog.Builder(context) .setTitle("Unblock Number") .setMessage("Do you want to unblock " + phoneNumber + "?") .setPositiveButton("Yes", (dialog, which) -> { BlockedNumbersManager manager = new BlockedNumbersManager(context); BlockedNumber blockedNumber = new BlockedNumber(); blockedNumber.setPhoneNumber(phoneNumber); blockedNumber.setContactName(getContactName(context, phoneNumber)); if (manager.unblockNumber(blockedNumber)) { Toast.makeText(context, "Number unblocked", Toast.LENGTH_SHORT).show(); } }) .setNegativeButton("No", null) .show(); } unblock a number on android

- Add permissions <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> <uses-permission android:name="android.permission.CALL_PHONE" /> 2. BlockedNumbersActivity.java - Main activity to view and unblock numbers public class BlockedNumbersActivity extends AppCompatActivity { private RecyclerView recyclerView; private BlockedNumbersAdapter adapter; private List<BlockedNumber> blockedNumbersList; private BlockedNumbersManager blockedNumbersManager; - List item layout &lt

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_blocked_numbers); blockedNumbersManager = new BlockedNumbersManager(this); recyclerView = findViewById(R.id.recyclerView); setupRecyclerView(); loadBlockedNumbers(); } ?xml version="1.0" encoding="utf-8"?&gt

private String getContactName(String phoneNumber) { ContentResolver contentResolver = context.getContentResolver(); Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber)); String[] projection = new String[]{ContactsContract.PhoneLookup.DISPLAY_NAME}; try (Cursor cursor = contentResolver.query(uri, projection, null, null, null)) { if (cursor != null && cursor.moveToFirst()) { return cursor.getString(0); } } return "Unknown Contact"; }

private void loadBlockedNumbers() { blockedNumbersList = blockedNumbersManager.getBlockedNumbers(); adapter.setData(blockedNumbersList); }

<androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent"/> </LinearLayout> - List item layout <?xml version="1.0" encoding="utf-8"?> <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="4dp" app:cardCornerRadius="8dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp"> <TextView android:id="@+id/tvNumber" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="18sp" android:textStyle="bold" android:textColor="#000000"/> <TextView android:id="@+id/tvName" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="#666666" android:layout_marginTop="4dp"/> <TextView android:id="@+id/tvBlockedDate" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="12sp" android:textColor="#999999" android:layout_marginTop="4dp"/> <Button android:id="@+id/btnUnblock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Unblock" android:layout_marginTop="8dp" style="?attr/materialButtonOutlinedStyle"/> </LinearLayout> </androidx.cardview.widget.CardView> 7. Optional: Add quick unblock from call log (CallLogHelper.java) public class CallLogHelper { public static void addUnblockButtonToCallLog(Context context, String phoneNumber) { // This can be integrated into your call log adapter new AlertDialog.Builder(context) .setTitle("Unblock Number") .setMessage("Do you want to unblock " + phoneNumber + "?") .setPositiveButton("Yes", (dialog, which) -> { BlockedNumbersManager manager = new BlockedNumbersManager(context); BlockedNumber blockedNumber = new BlockedNumber(); blockedNumber.setPhoneNumber(phoneNumber); blockedNumber.setContactName(getContactName(context, phoneNumber)); if (manager.unblockNumber(blockedNumber)) { Toast.makeText(context, "Number unblocked", Toast.LENGTH_SHORT).show(); } }) .setNegativeButton("No", null) .show(); }

- Add permissions <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> <uses-permission android:name="android.permission.CALL_PHONE" /> 2. BlockedNumbersActivity.java - Main activity to view and unblock numbers public class BlockedNumbersActivity extends AppCompatActivity { private RecyclerView recyclerView; private BlockedNumbersAdapter adapter; private List<BlockedNumber> blockedNumbersList; private BlockedNumbersManager blockedNumbersManager;

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_blocked_numbers); blockedNumbersManager = new BlockedNumbersManager(this); recyclerView = findViewById(R.id.recyclerView); setupRecyclerView(); loadBlockedNumbers(); }

private String getContactName(String phoneNumber) { ContentResolver contentResolver = context.getContentResolver(); Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber)); String[] projection = new String[]{ContactsContract.PhoneLookup.DISPLAY_NAME}; try (Cursor cursor = contentResolver.query(uri, projection, null, null, null)) { if (cursor != null && cursor.moveToFirst()) { return cursor.getString(0); } } return "Unknown Contact"; }