@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = (ViewGroup) inflater.inflate(R.layout.submission_imagecard, container, false); image = (SubsamplingScaleImageView) rootView.findViewById(R.id.image); PopulateShadowboxInfo.doActionbar(s, rootView, getActivity()); (rootView.findViewById(R.id.thumbimage2)).setVisibility(View.GONE); type = ContentType.getImageType(s); if (type.toString().toLowerCase().contains("image") && type != ContentType.ImageType.IMAGE_LINK) { addClickFunctions(image, rootView, type, getActivity(), s); loadImage(s.getUrl()); } else if (s.getDataNode().has("preview") && s.getDataNode().get("preview").get("images").get(0).get("source").has("height") && s.getDataNode().get("preview").get("images").get(0).get("source").get("height").asInt() > 200) { loadImage( s.getDataNode().get("preview").get("images").get(0).get("source").get("url").asText()); } else { image.recycle(); (rootView.findViewById(R.id.thumbimage2)).setVisibility(View.VISIBLE); ((ImageView) rootView.findViewById(R.id.thumbimage2)).setImageResource(R.drawable.web); addClickFunctions( (rootView.findViewById(R.id.thumbimage2)), rootView, type, getActivity(), s); (rootView.findViewById(R.id.progress)).setVisibility(View.GONE); } rootView .findViewById(R.id.base) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent i2 = new Intent(getActivity(), CommentsScreen.class); i2.putExtra(CommentsScreen.EXTRA_PAGE, i); i2.putExtra(CommentsScreen.EXTRA_SUBREDDIT, sub); (getActivity()).startActivity(i2); } }); return rootView; }