=======================================
activity_main.xml
=======================================

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    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"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@color/white"
        android:text="MAD Lab Auto text view"
        android:textColor="@color/teal_200"
        android:layout_centerHorizontal="true"/>

    <AutoCompleteTextView
        android:id="@+id/text2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/text1"
        android:layout_marginTop="20dp"
        android:hint="Enter the fruit name"
        android:textColor="@color/teal_200"
        android:textStyle="bold" />

</RelativeLayout>

=======================================
MainActivity.kt
=======================================


package com.example.cie3_listview

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.widget.ArrayAdapter
import android.widget.AutoCompleteTextView

class MainActivity : AppCompatActivity() {

    private val fruits = arrayOf(
        "Apple", "Banana", "Cherry", "Date",
        "Grape", "Kiwi", "Mango", "Orange"
    )

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        title = "Kotlin App"

        val autoTextView: AutoCompleteTextView = findViewById(R.id.text2)

        val adapter: ArrayAdapter<String> = ArrayAdapter(
            this,
            android.R.layout.select_dialog_item,
            fruits
        )

        autoTextView.threshold = 1
        autoTextView.setAdapter(adapter)
    }
}