0

recreate() cant be resolved in fragment activity.

mBuilder.setSingleChoiceItems(listItems, -1, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int i) {


                if( i==0 )
                {setLocale("per");
                    recreate();}


                if( i==1 )
                {setLocale("en");
                    recreate();}

            dialog.dismiss();
        }
    });

I use this method in fragment activity as below:

public class SettingsFragment extends Fragment implements FragmentArguments {
Zoe
  • 27,060
  • 21
  • 118
  • 148
Saeedeh
  • 297
  • 1
  • 4
  • 21

1 Answers1

1

There is no recreate method in a Fragment. Its a method inherited from an Activity. If you want the recreate the Activity from the fragment, you can call

getActivity().recreate();

If you want to reload just the Fragment, you can detach the fragment and then attach it again like this.

getSupportFragmentManager()
    .beginTransaction()
    .detach(YourFragment.this)
    .attach(YourFragment.this)
    .commit();
Yasiru Nayanajith
  • 1,647
  • 17
  • 20