I am replacing the existing fragment with new fragment and i am able to see my view but while setting on click listener on the button it returns null . I get the following e
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
savedInstanceState) {
View view = inflater.inflate(R.layout.capture_card_phone_number, container, false);
mPhone = (AutoCompleteTextView) getActivity().findViewById(R.id.phone_number);
Button next = (Button) view.findViewById(R.id.capture_phone_next);
next.setOnClickListener(this);
return view;
You have to call findViewById on your view - not on your activity.