自定义适配器中的android if语句

时间:2014-08-22 22:26:02

标签: android if-statement

当我点击更改img时,我再次点击它将其更改为另一个,我制作了明星ImageView。 在列表视图中使用ImageView的问题我做的一切都很好,但是当我在自定义适配器中使用if语句if语句不起作用并且其更改随机img star 我只想在IF语句之后更改特定的ImageView。

 final ImageView ima= (ImageView) convertView.findViewById(R.id.imagestar);

 String path = "/storage/emulated/0/data/" + m.getTitle() + ".txt";
  File f = new File(path);       
      if (f.getName().equals(m.getTitle() + ".txt"))
       {
        File file2 = new File("/storage/emulated/0/data/" + m.getTitle() + ".txt");
        if(file2.exists())      
        {
             System.out.println(f.getName());
             ima.setImageResource(R.drawable.button_pressed);

        }
       }

谢谢大家。

0 个答案:

没有答案