Reload the fragment in android?
NickName:Test123 Ask DateTime:2014-11-17T14:28:55

Reload the fragment in android?

I am building an android application where on click of add button an viewdailog box is open an in there is an fom fill by the user.

I need is that on click of ok button of that viewdailog box my fragment should be reloaded as user has added the vaules.

Here is the method that I am using in viewDialog box - \

private void viewCategory() {

        AlertDialog.Builder viewDialog = new AlertDialog.Builder(getActivity());

        viewDialog.setTitle("add");

        LayoutInflater li = (LayoutInflater)     
        getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View dialogView = li.inflate(R.layout.customealertdialogbox1, null);
        viewDialog.setView(dialogView);

        viewDialog.setPositiveButton("Ok",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        name = edt1.getText().toString();
                        address = edt2.getText().toString();
                        city = edt3.getText().toString();
                        phone = edt4.getText().toString();
                        //Toast.makeText(getActivity(), name, Toast.LENGTH_SHORT).show();
                        new DownloadJSON().execute();

                    }
                });

        viewDialog.setNegativeButton("Cancel",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {

                    }
                });
        viewDialog.show();

        edt1 = (EditText) dialogView.findViewById(R.id.editbox1);
        edt2 = (EditText) dialogView.findViewById(R.id.editbox2);
        edt3 = (EditText) dialogView.findViewById(R.id.editbox3);
        edt4 = (EditText) dialogView.findViewById(R.id.editbox4);
 }

Copyright Notice:Content Author:「Test123」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/26966801/reload-the-fragment-in-android

More about “Reload the fragment in android?” related questions

reload a fragment android if exist else create it

I'm using android.support.v4.app.Fragment and android 2.3 version, so i wont if i click a button to create an instance of my fragment it verify his existance before, and in the case that it exist i

Show Detail

Android prevent webview reload in fragment

I have a main activity that contains a frame layout and 4 tab buttons, and there are in total 4 fragments, each fragment relates to a tab button, depending on which tab button is clicked, the

Show Detail

Refresh Fragment at reload

In an android application I'm loading data from a Db into a TableView inside a Fragment. But when I reload the Fragment it displays the previous data. Can I repopulate the Fragment with current data

Show Detail

Android - Reload Fragment into a ViewPager

I'm building an App which extracts data from a SQLite local database. I have an Activity, in which I use a ViewPager; in this ViewPager, there are 12 swipable Fragments. I'd like to implement a "...

Show Detail

Reload a Fragment

everyone, my issue is : I'm in ProfilFragment, that was generated with the Menu Drawer it extends Fragment, and I can't change this (it broke some other part). When I click on a button I want to

Show Detail

Android Java Reload Refresh Acitivity Fragment

Is it possible to refresh / reload the application in Java / Android. If so how do I do that in a Fragment and / or in the MainActivity. Pretty new to Android. I basically have a date countdown wh...

Show Detail

Reload Fragment

I am just curious, as I have set up Fragment tabs in a FragmentActivity, how to reload a fragment either from the FragmentActivity, or from the Fragment itself, to just purge and reload that tab. I

Show Detail

Android Fragment reload after onclick

I am using the material design tabs. I have different fragment on each tab. In one fragment I have edit Text and button and bellow is list view. ListView is populate from api and also message is cr...

Show Detail

Not to reload the fragment once loaded-ANDROID

In my Android app I have 6 fragments which are replaced one by one on clicking item in navigation drawer. My problem is that fragment are loaded again and again when clicking on navigation drawer i...

Show Detail

Reload fragment when onTabReselected android

I has a TabNews extent extends Fragment And when this tab reselected, I want reload this tab, How can do it? @Override public void onTabReselected(Tab tab) { if(tab.getPosition() == 3) { ...

Show Detail