• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to select messages from a specific phone number (Kotlin Android)

Code:
val cursor = contentResolver.query(Uri.parse("content://sms/inbox"), null, null, null, null)
if (cursor != null) {
        //cursor.moveToFirst()
        cursor.moveToPosition(1)

        var text = cursor.getString(12)
        Toast.makeText(applicationContext,text,Toast.LENGTH_SHORT).show()
    }

1- I want to read received messages from "50004000151398" only (not all inbox)

2- I want to see how many messages I have received from "50004000151398"

What should I do?

(I did not understand the current answers)
 
Back
Top Bottom