Skip to content

Instantly share code, notes, and snippets.

@target-trust
Last active August 29, 2015 14:04
Show Gist options
  • Save target-trust/ba0f591f5d0b7665d2e7 to your computer and use it in GitHub Desktop.
Save target-trust/ba0f591f5d0b7665d2e7 to your computer and use it in GitHub Desktop.
@Override
publicView getView(int itempos, View convertView, ViewGroup parent) {
//Check if the convertview is null, if it is null it probably means that this //is the first time the view has been displayed
if (convertView == null)
{
convertView = View.inflate(context, R.layout.list_content_layout, null);
}
//If it is not null, you can just reuse it from the recycler
TextView txtcontent = (TextView) convertView.findViewById(R.id.textView1);
ImageView imgcontent = (ImageView) convertView.findViewById(R.id.imageView1);
Paintings paintingcontent = content[itempos];
txtcontent.setText(paintingcontent.imagetitle);
imgcontent.setImageResource(paintingcontent.drawableresid);
// return the view for a single item in the listview
return convertView;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment