Update WhitelistContactsActivity.java

This commit is contained in:
Alessandro Ferro 2022-10-25 10:23:58 +02:00
parent 9706c31afb
commit 7f9ce69a4c
1 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ public class WhitelistContactsActivity extends AppCompatActivity {
private ListView contactsListView; private ListView contactsListView;
private ArrayList<String> contacts; private ArrayList<String> contacts;
private ArrayAdapter<String> listviewAdapter; private ArrayAdapter<String> listviewAdapter;
private WhitelistDbHandler whitelistDbHandler = new WhitelistDbHandler(this); private final WhitelistDbHandler whitelistDbHandler = new WhitelistDbHandler(this);
private static final int CONTACT_PICK_CODE = 123; private static final int CONTACT_PICK_CODE = 123;
@ -67,7 +67,7 @@ public class WhitelistContactsActivity extends AppCompatActivity {
} }
// Add "add" button on the top // Add "add contact" button on the top
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_add, menu); getMenuInflater().inflate(R.menu.menu_add, menu);
@ -91,7 +91,7 @@ public class WhitelistContactsActivity extends AppCompatActivity {
@Override @Override
protected void onActivityResult (int requestCode, int resultCode, Intent data) { protected void onActivityResult (int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK && requestCode == 123) { if (resultCode == Activity.RESULT_OK && requestCode == CONTACT_PICK_CODE) {
Uri contactData = data.getData(); Uri contactData = data.getData();
Cursor c = getContentResolver().query(contactData, null, null, null, null); Cursor c = getContentResolver().query(contactData, null, null, null, null);
if (c.moveToFirst()) { if (c.moveToFirst()) {