how add search filter bar in listview kotlin

l have created a list view and the code working fine . also created a search box . I want to implement search functionality on the basis of particular fields of the list. l used list adapter in Separated class is not in main activity class . l want use search bar filter in class list adapter

class ListAdapteArr (val context: MainActivity, val list: ArrayList<FlightShdu>): BaseAdapter() {
    @SuppressLint("ViewHolder", "NewApi")
    override fun getView(p0: Int, convertView: View?, parent: ViewGroup?): View {

        val view : View = LayoutInflater.from(context).inflate(R.layout.arr_list,parent,false)


        val search = view.findViewById(R.id.searchFlightId) as TextView

        Airport.text= list.Airport




        return view

    }




    override fun getItem(p0: Int): Any {
        return list [p0]
    }

    override fun getItemId(p0: Int): Long {
        return p0.toLong()
    }

    override fun getCount(): Int {
        return list.size
    }



}

xml

   <ListView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/flight_arrivel_list"
            style="@style/Widget.AppCompat.ListView"
            android:paddingStart="10sp"
            android:paddingEnd="10sp"
            android:paddingTop="0dp" android:layout_alignParentStart="true" android:layout_alignParentTop="true"
            android:layout_marginTop="58dp" android:layout_marginStart="0dp"/>
    <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPersonName"
            android:ems="10"
            android:layout_alignParentTop="true" android:id="@+id/searchFlightId"
            android:layout_marginTop="0dp" style="@style/Widget.AppCompat.AutoCompleteTextView"
            android:singleLine="false" android:hint="search"
            android:layout_alignParentStart="true"/>

any solution ?.

This is not really a Kotlin problem, it is an Android problem. First of all, look at RecyclerView as Listview in most cases is the wrong class (and is not updated). The text view is not an element in the adapter (which is responsible for managing list elements), its changes however need to be communicated to the adapter (helped by the activity/fragment) so that it can filter as needed.

thank you for replied . l am new in kotlin can you please give my answer withe updating my code which l want above ?