I am trying to create an ImageView in a Fragment which will refer to the ImageView element which I have created in the XML for the Fragment. However, the findViewById<
findViewById<
Use
imagebutton = (ImageButton) getActivity().findViewById(R.id.imagebutton1); imageview = (ImageView) getActivity().findViewById(R.id.imageview1);
it will work