So I saw two tutorials about removing contacts in Android Studio, but one was an entire project with "selecting features", which I don't have enough space to add in my app, and in the other one I was suppose to create databases and other variables.
My question is if there's any easy solution to make a button that once pressed has the option to select any of the contacts in the list and, upon clicking them, show a message that asks if the person is sure they want to delete it.
Another nice feature would be to make the contacts a different color so the person is sure they're in "delete mode".
What my activity_main looks like:
I also made a class just to remove contacts, but I don't know if it's necessary (this is just the MainActivity):
public class MainActivity extends AppCompatActivity {
RecyclerView recyclerView;
ArrayList<ContactModel> arrayList = new ArrayList<>();
MainAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = findViewById(R.id.recycler_view);
checkPermission();
}
private void checkPermission() {
if (ContextCompat.checkSelfPermission(MainActivity.this
, Manifest.permission.READ_CONTACTS)
!=PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.READ_CONTACTS}, 100);
}else{
getContactList();
}
Button add_btn = findViewById(R.id.add_btn);
add_btn.setOnClickListener(v -> startActivity(new Intent(MainActivity.this, Add_Contact.class)));
Button rem_btn = findViewById(R.id.rem_btn);
rem_btn.setOnClickListener(v -> startActivity(new Intent(MainActivity.this, Remove_Contact.class)));
}
And as you can see, the "Remove Contact" Button is connected to the rem_btn, which in itself is connected to the class "Remove_Contact".
Again, I don't know if it's necessary to make an entire class for it, but I would assume that, because most of the contact list is done, a lot of the code is not necessary.
I'm also learning the various implements in Android Studio, and, as I'm working on this, I also have a limited amount of time to work on this project.
Any help would be greatly appreciated!

Here is a solution that shows you how to delete all contacts in a loop. how to delete all contacts in contact list on android mobile programatically You just need some of the contacts information to tell which one to delete which you already have from the list.
You may need the
WRITE_CONTACTSpermission.