Есть функция refresh()
в фрагменте, которая обновляет содержимое в нем. Каким образом можно сделать функцию статической, чтобы ее можно было бы вызвать из другого класса?
public class LoftFragment extends Fragment {
public static String LOG_TAG = "my_log";
static TextView temp_indor;
static TextView humidity_indor;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.loft_layout, container, false);
temp_indor = (TextView) view.findViewById(R.id.temp_indor);
temp_indor.setText(ParseData.value_temp_indor);
humidity_indor = (TextView) view.findViewById(R.id.humidity_indor);
humidity_indor.setText(ParseData.value_humidity_indor);
return view;
}
public static void refresh() {
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.detach(this).attach(this).commit();
}
}