I have this getView method inside my ListViewAdapter:
public static class ViewHolder{
public TextView textTitle;
public ImageView image;
}
public View getView(int position, View convertView, ViewGroup parent)
{
Project pro = getItem(position);
View vi=convertView;
ViewHolder holder;
if(convertView==null){
vi = inflater.inflate(R.layout.listitems, null);
holder=new ViewHolder();
holder.textTitle=(TextView)vi.findViewById(R.id.txt_title);;
holder.image=(ImageView)vi.findViewById(R.id.image);
vi.setTag(holder);
}
else
holder=(ViewHolder)vi.getTag();
holder.textTitle.setText(pro.project_title);
holder.image.setTag(pro);
imageLoader.DisplayImage(pro.smallImageUrl, activity, holder.image);
return vi;
}
since this is for a listview, it shows both images and text.
In the other hand I have an activity, where I want to apply the imageLoader.DisplayImage
method in it only to show images.
Based on the ListView Adapter, I made this inside an activity:
imageLazy(image1, Main.this, prjcts.get(randomIndex1));
public void imageLazy(final ImageView image, Activity activity, Project pro)
{
imageLoaderx.DisplayImage(pro.smallImageUrl, activity, image);
}
But then my app crashed. The Logcat reports a Nullpointer Exception Error and an error with my imageLazy method.
Can anybody help me to solve my problem? So that my method can display the images without error? Thank you very much