I want to implement SearchView with multiple fragments present in a viewPager. All fragemnts contains lists and I want to filter those lists and create a new ListView which has
Below hint may help you
public class AnyActivity extends AppCompatActivity {
private ListenFromActivity activityListener1;
}
then define interface with separate file
public interface ListenFromActivity {
void doSearchInFragment(String SearchKey);
}
now in your fragment
public class Connections extends Fragment implements ListenFromActivity
{
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
((AnyActivity)Objects.requireNonNull(getActivity())).setActivityTab1Listener(Connections.this);
}
@Override
public void doSearchInFragment(String SearchKey) {
//pass to any network or local call.
}
}