I want to convey the value between the dialogue and the fragment, save it

setNumbers(view.getContext(), holder.mBoundString); public static String setNumbers(Context context, String numbers) { PreferenceManager.getDefaultSharedPreferences(context).edit() .putString(PREF_NUMB_NUMBERS, numbers).apply(); Log.i(PREF_NUMB_NUMBERS, "QueryTextSubmit: " + numbers); return numbers; } 

With

 String numbers = NumbSheetDialogView.setNumbers(getActivity(), "1"); 

Value does not come

    1 answer 1

     System.out.println(PreferenceManager.getDefaultSharedPreferences(context).getString(PREF_NUMB_NUMBERS, "DEFAULT_VALUE")); 
    • I don't know what's the matter writing String numbers = NumbSheetDialogView.setNumbers (getActivity (), "1"); Value does not come, washes I call there not? Oncreekview - Artem
    • thanks so works. But is it possible according to my method how to get a thread - Artem
    • How can I check that the value has been updated? - Artem
    • @ Artem, I do not understand what your problem is. - Yuriy SPb
    • How can I check the current value of PREF_NUMB_NUMBERS and compare it with the current PREF_NUMB_NUMBERS , has it changed - Artem