0

I have an android app that l am busy with but ran into a small problem. I am trying to refresh/restart my fragement after saving data by the use of the save button but l am getting the following err:

Attempt to invoke virtual method 'void android.support.v4.app.Fragment.setNextAnim(int)' on a null object reference

here is my code in the button:

    save1.setOnClickListener(new View.OnClickListener(){
    @Override
    public void onClick(View v) {
        //Util.displayMessage(getContext(),"Saving");
        String textToStore = contact1.getText().toString();
        String textToStore2 = contact2.getText().toString();
        String Url = "/gps/savetaxiroutes/"+imei+"/"+textToStore+"/"+textToStore2 +"/"+ sendNotification.toString()  ;

        AllContacts fragment = (AllContacts) 
                getFragmentManager().findFragmentById(R.id.thelayout2)

        getFragmentManager().beginTransaction()
                .detach(fragment)
                .attach(fragment)
                .commit();
        mPopupWindow.dismiss();
    }
    });

this is how the code is structured in my save button method.

Sarath Kn
  • 2,680
  • 19
  • 24
Evans Munatsa
  • 39
  • 1
  • 7

1 Answers1

-1

Please read your error carefully and post related code where you using setNextAnim()'or starting Fragment

Attempt to invoke virtual method 'void android.support.v4.app.Fragment.setNextAnim(int)' on a null object reference
Sandeep Parish
  • 1,888
  • 2
  • 9
  • 20