How to add or change About us icon with action

I buy RocketWeb from codecanyon and running the app successfully now I want to add what’s app button on about us.

From popup_about_us.xml you found the option to change or set icon. If you want to set .png icon remember that the name if icon must be a small letter and without special character (ex: ic_whats_app.png). Set your icon in a drawable folder.

In my case, I used a vector icon. But for png code will be:

<ImageView
    android:id="@+id/img_skype"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/ic_circle"
    android:backgroundTint="@color/colorAccent"
    android:foreground="?attr/selectableItemBackground"
    android:padding="@dimen/margin_2"
    android:layout_marginLeft="@dimen/margin_2"
    android:src="@drawable/ic_whats_app"/>

Now to click the event you found below code on HomeActivity.kt file. If you want to change the skype button then code will be.

btnSkype.setOnClickListener {
    try{
        val contact = "+009876543210" // use country code with your phone number
        val url = "https://api.whatsapp.com/send?phone=$contact"
        try {
            val pm = mContext.getPackageManager()
            pm.getPackageInfo("com.whatsapp", PackageManager.GET_ACTIVITIES)
            val i = Intent(Intent.ACTION_VIEW)
            i.data = Uri.parse(url)
            startActivity(i)
        } catch (e: PackageManager.NameNotFoundException) {
            UtilMethods.showLongToast(mContext, "Whatsapp app not installed in your phone" )
            e.printStackTrace()
        }
    }catch (ex: Exception){
        ex.printStackTrace()
    }
}

Leave a Reply