我试图检查一个目录是否存在,如果确实存在,我想让listview中的imageview可见。由于某种原因,即使目录存在,也不会将imageview设置为可见。有谁知道问题是什么?
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
String item = data.get(position);
ImageView ib = (ImageView)row.findViewById(R.id.alreadyDownloaded);
TextView textView = (TextView)row.findViewById(R.id.fontTextView);
textView.setText(data.get(position));
File dfDir = new File(Environment.getExternalStorageDirectory() + "/DownloadedFonts"+ (data.get(position)));
if(dfDir.isDirectory()) {
//if (item.equals("Helvetica") ){ if i use this it hides the image properly
ib.setVisibility(View.VISIBLE);
}
return row;
}