MaterialSearchBar icon indicating copy to clipboard operation
MaterialSearchBar copied to clipboard

I want to set searchBar.SetText( ) from suggestion adapter list click

Open israilbony opened this issue 6 years ago • 1 comments

israilbony avatar May 19 '18 08:05 israilbony

Implement a interface in your adapter like this:

public interface ICallback {
        void onClick(int position);
    }

Call that inteface function on suggestion click in onbindview

holder.itemView.setOnClickListener(v -> {
            iCallBack.onClick(position);
        });

Go to the calling activity where you have set the adapter and lets say if you have string in suggestion and onclick you want to set that string on your search bar then

onClick(int position) {
searchbar.setText(suggestion.get(position)) ;
}

rhlmshr avatar Jul 29 '18 08:07 rhlmshr