MainActivity.kt
package com.cfsuman.kotlintutorials
import android.app.Activity
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import android.util.TypedValue
import com.google.android.material.chip.Chip
class MainActivity : Activity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        // get the widgets reference from XML layout
        val chipYellow = findViewById<Chip>(R.id.chipYellow)
        // set chip border color programmatically
        chipYellow.chipStrokeColor = ColorStateList.valueOf(
            Color.parseColor("#007aa5")
        )
        // set chip border width in pixels programmatically
        chipYellow.chipStrokeWidth = 2.dpToPixels(this)
    }
}
// extension function to convert dp to equivalent pixels
fun Int.dpToPixels(context: Context):Float = TypedValue.applyDimension(
    TypedValue.COMPLEX_UNIT_DIP,
    this.toFloat(),
    context.resources.displayMetrics
)
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#DCDCDC"
    android:padding="48dp">
    <com.google.android.material.chip.ChipGroup
        android:id="@+id/chipGroup"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">
        <com.google.android.material.chip.Chip
            android:id="@+id/chipCharcoal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/Widget.MaterialComponents.Chip.Filter"
            app:chipStrokeColor="#36454f"
            app:chipStrokeWidth="2dp"
            android:text="Charcoal" />
        <com.google.android.material.chip.Chip
            android:id="@+id/chipYellow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/Widget.MaterialComponents.Chip.Filter"
            android:text="Yellow" />
    </com.google.android.material.chip.ChipGroup>
</androidx.constraintlayout.widget.ConstraintLayout>
- android kotlin - Volley JsonArrayRequest
 - android kotlin - Volley JsonObjectRequest
 - android kotlin - Volley image request
 - android kotlin - Chip background color
 - android kotlin - Chip checked color programmatically
 - android kotlin - ChipGroup get selected chips
 - android kotlin - ChipGroup add chip programmatically
 - android kotlin - EditText allow only certain characters
 - android kotlin - Set EditText digits programmatically
 - android kotlin - EditText allow only positive numbers
 - android kotlin - EditText allow only characters and numbers
 - android kotlin - EditText numbers only programmatically
 - android kotlin - EditText min length
 - android kotlin - EditText rounded corners programmatically
 - android kotlin - EditText border color programmatically