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 ?.