Here is my code
public void refreshSmsInbox() {
ContentResolver contentResolver = getContentResolver();
Cursor smsInboxCursor = contentResolver.query(Uri.parse("content://sms/inbox"), null, null, null, null);
int indexBody = smsInboxCursor.getColumnIndex("body");
int indexAddress = smsInboxCursor.getColumnIndex("address");
if (indexBody < 0 || !smsInboxCursor.moveToFirst()) return;
arrayAdapter.clear();
do {
if (smsInboxCursor.getString(indexAddress).toString()=="6641234567") {
String str = "SMS From:" + smsInboxCursor.getString(indexAddress) +
"\n" + smsInboxCursor.getString(indexBody) + "\n";
arrayAdapter.add(str);
}
else {
String str = "It doesnt work";
arrayAdapter.add(str);
}
Log.d("Phone Number",smsInboxCursor.getString(indexAddress));
} while (smsInboxCursor.moveToNext());
}
I want to make a app that pop up when a certain phone number send you a sms I already make that the app read the sms but when i try to make the app show the messages from only certain number it doesnt enter but i dont know why i make a debug resaearh from smsInboxCursor.getString(indexAddress).toString()
and it give me this and the result is the same from my condition
also here is the view from my aplication
And here is the view when i removed the if statement
it is very weird for my There is an explination for this? because i can see that the comparasion i made in the if statement is the same that the output in the logcat