Unblock A Number On Android Free May 2026
public String getBlockedDate() { return blockedDate; } public void setBlockedDate(String blockedDate) { this.blockedDate = blockedDate; } } - Layout file <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="16dp"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Blocked Numbers" android:textSize="24sp" android:textStyle="bold" android:layout_marginBottom="16dp"/>
public boolean unblockNumber(BlockedNumber blockedNumber) { Set<String> blockedSet = sharedPreferences.getStringSet(KEY_BLOCKED_LIST, new HashSet<>()); Set<String> newBlockedSet = new HashSet<>(blockedSet); String numberToRemove = null; for (String numberJson : blockedSet) { try { JSONObject jsonObject = new JSONObject(numberJson); if (jsonObject.getString("number").equals(blockedNumber.getPhoneNumber())) { numberToRemove = numberJson; break; } } catch (JSONException e) { e.printStackTrace(); } } if (numberToRemove != null && newBlockedSet.remove(numberToRemove)) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putStringSet(KEY_BLOCKED_LIST, newBlockedSet); editor.apply(); // Also remove from system call blocking if applicable removeFromSystemBlockList(blockedNumber.getPhoneNumber()); return true; } return false; } unblock a number on android
private void setupRecyclerView() { recyclerView.setLayoutManager(new LinearLayoutManager(this)); adapter = new BlockedNumbersAdapter(); recyclerView.setAdapter(adapter); } public String getBlockedDate() { return blockedDate
public List<BlockedNumber> getBlockedNumbers() { Set<String> blockedSet = sharedPreferences.getStringSet(KEY_BLOCKED_LIST, new HashSet<>()); List<BlockedNumber> blockedNumbers = new ArrayList<>(); for (String numberJson : blockedSet) { try { JSONObject jsonObject = new JSONObject(numberJson); BlockedNumber blockedNumber = new BlockedNumber(); blockedNumber.setPhoneNumber(jsonObject.getString("number")); blockedNumber.setBlockedDate(jsonObject.getString("date")); blockedNumber.setContactName(getContactName(jsonObject.getString("number"))); blockedNumbers.add(blockedNumber); } catch (JSONException e) { e.printStackTrace(); } } return blockedNumbers; } } } - Layout file <
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"; }
public String getContactName() { return contactName; } public void setContactName(String contactName) { this.contactName = contactName; }