do it first:
View layout = inflater.inflate(R.layout.popup, (ViewGroup) findViewById(R.id.layout_root));
Then, after defining layout , do the following:
ImageView dialogimage = (ImageView) layout.findViewById(R.id.popupimage);
Call findViewByID() on the new layout you created, and not on the parent content view.
So, two changes: Ordering and layout.findView not findView
source share