have run the code in my phone or just the "else" condition is working.on running the app just displays the "package is not installed"
"Kotlin"
    val button = findViewById<Button>(R.id.openwhtaspchat)
    button.setOnClickListener {
    val uri = Uri.parse("smsto"+"+923354859491")
        val intent = Intent(Intent.ACTION_SENDTO,uri)
        intent.setPackage("com.whatsapp")
        if (intent.resolveActivity(this.packageManager)!=null){
            startActivity(intent)
        }else{
            Toast.makeText(this,"package is not installed",Toast.LENGTH_SHORT).show()
        }
 
     
    