in my android app i have an SQLite Database with phone number (here I changed the numbers with other inexistent for privacy)!
mySQLiteAdapter = new SQLiteAdapter(this);
mySQLiteAdapter.openToRead();
I created a List containing the numbers from database and printed on the screen to see if it works and it give me back correct the numbers!
List numeri = mySQLiteAdapter.getAllNumeri();
System.out.println("num tel: " + phone);
It give me back two numbers present in database --> [3401234567, 02123456]
Then i tryed to compare the incoming number of a call with this List with this metod:
String phone = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
System.out.println("Incoming number - " + phone);
boolean retval = numeri.contains(phone);
if (retval == true) {
System.out.println("PHONE is contained in the list");
}
else {
System.out.println("PHONE is not contained in the list");
}
I tryed to call with my number 3401234567!
The println give me back: Incoming number: +393401234567
and
The condition give me back that "PHONE is not contained in the list!"
I tryed also to change database numbers by adding the national prefix (+39) but it don t works!
Can anyone help me? Thanks
I think it isn t duplicate because in other question, compare two string, here i want compare one string with arraylist