Обновление Fragment по нажатию кнопки
Мне нужно сделать перезагрузку Fragment'а по нажатию на кнопку из самого этого фрагмента. (с целью обновления recyclerview) Подскажите, как это можно сделать?
TechnologyFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_technology, container, false);
//FAB-кнопка
FloatingActionButton floatingActionButton = view.findViewById(R.id.fab);
floatingActionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//перезагрузка
}
});
return view;
}
fragment_technology.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="Technology.TechnologyFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewTechnology"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
android:src="@drawable/baseline_autorenew_24"
android:onClick="onClickDone"
tools:ignore="OnClick,UsingOnClickInXml" />
</FrameLayout>