I have a listView, a main xml file and a customListview xml file.
for my listView I am using a custom ArrayAdapter which I made.
Now, i would like to set an image as a resource in my MainActivity class.
the problem is that the image is in another xml, not in this which i set the contentView.
I am trying this code but nothing happens:
LayoutInflater mInflater=(LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
View view=mInflater.inflate(R.layout.custom_row_view,null);
ImageView statusOk=(ImageView)view.findViewById(R.id.statusOkImage);
statusOk.setImageResource(R.drawable.ic_launcher);
If interested in all the code, youcan see here:
ImageView setVisibility(0) and null pointer exception
Change your get method in base adapter: