Building an Android app and having some trouble. I'd appreciate any help!
I have created an class that extends DialogFragment (Account_Create_Error) that I call from Activity A. I want to set the TextView field in this DialogFragment from Activity A. I created a method in my dialogfragment
public void setError(String message) {
TextView error = (TextView)getActivity().findViewById(R.id.message);
error.setText(message);
}
I then use this method in Activity A by doing
Account_Create_Error error = new Account_Create_Error();
error.show(getFragmentManager(), "error");
error.setError(json.getString("response"));
I seem to get a nullpointer exception from findViewById.
Please let me know if providing any more of my code would be helpful.
Thank you!!