How to use LIKE clause in query function

前端 未结 3 1380
感情败类
感情败类 2021-01-05 11:37

I am making an application which search messages in the inbox based on sender number. Here is my code:

public void onClick(View v)
{
    Toast.makeText(this,         


        
3条回答
  •  萌比男神i
    2021-01-05 12:12

    Try following EDITED:

    String[] argList = {"'%%%%"+searchtxt.getText().toString()+"%%%%'"};//TRY  THIS
                          ^^^^                                  ^^^^  // TRY THIS
    
    Uri smsUri = Uri.parse("content://sms/inbox");
    Cursor c = getContentResolver().query(smsUri, colList, "address LIKE ?", argList, "DATE");
    

提交回复
热议问题