Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
156 views
in Technique[技术] by (71.8m points)

java - I am not changing strings in the nav drawer When I clicked change language butt?on

I am trying to change my application language but when I clicked the language button, in the pages, texts (strings) are changing but in the nav drawer nothing change. If an exit the program pages strings changing also nav drawer is changing. My problem is While the app is playing language button change together.

This code is changing languages:

    @Override
            public void onClick(View v) {
                try {
                    if (home.dil == 2){
                        Toast.makeText(getActivity(), "Türk?e dili se?ildi", Toast.LENGTH_SHORT ).show();
                        dil = 1;
                        dild = "tr";
                        Fragment frg = new home();
                        FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
                        ft.detach(frg);
                        ft.attach(frg);
                        ft.addToBackStack(home.class.getSimpleName());
                        ft.commit();
                        FragmentTransaction fti = getFragmentManager().beginTransaction();
                        fti.detach(home.this).attach(home.this).commit();

                    }
                    else {
                        Toast.makeText(getActivity(), "English language selected", Toast.LENGTH_SHORT ).show();
                        dil = 2;
                        dild = "";
                        Fragment frg = new home();
                        FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
                        ft.detach(frg);
                        ft.attach(frg);
                        ft.addToBackStack(home.class.getSimpleName());
                        ft.commit();
                        FragmentTransaction fti = getFragmentManager().beginTransaction();
                        fti.detach(home.this).attach(home.this).commit();
                    }
                } catch (Exception e) {
                }
            }
        });

these are how it is going to show

This is how looking the nav drawer

question from:https://stackoverflow.com/questions/65865075/i-am-not-changing-strings-in-the-nav-drawer-when-i-clicked-change-language-butt%c4%b1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...