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.