0

Here's my codes it's pretty simple.

ImageView newphone = (ImageView) rowView.findViewById(R.id.newsign);
        System.out.println(BeanClass.get(position).newphone.toLowerCase());
        if (BeanClass.get(position).newphone.toLowerCase() == "no") {
            newphone.setVisibility(View.GONE);
        } else {
            newphone.setVisibility(View.VISIBLE);

        }

The imageview is always visible in the listview. Here's my logcat :

07-21 16:26:14.426: I/System.out(7480): no
07-21 16:26:14.496: I/System.out(7480): no
07-21 16:26:14.611: I/System.out(7480): no
07-21 16:26:14.896: I/System.out(7480): no
07-21 16:26:14.926: I/System.out(7480): no
07-21 16:26:14.946: I/System.out(7480): no
07-21 16:26:14.966: I/System.out(7480): no
07-21 16:26:14.991: I/System.out(7480): no
07-21 16:26:15.026: I/System.out(7480): no
07-21 16:26:15.041: I/System.out(7480): no
07-21 16:26:15.076: I/System.out(7480): no
07-21 16:26:15.091: I/System.out(7480): yes
07-21 16:26:15.126: I/System.out(7480): no
07-21 16:26:15.161: I/System.out(7480): no
07-21 16:26:15.196: I/System.out(7480): no
07-21 16:26:15.246: I/System.out(7480): no
07-21 16:26:15.276: I/System.out(7480): no
07-21 16:26:15.326: I/System.out(7480): no
07-21 16:26:15.396: I/System.out(7480): no
07-21 16:26:15.461: I/System.out(7480): no
07-21 16:26:15.541: I/System.out(7480): no
07-21 16:26:15.661: I/System.out(7480): no
07-21 16:26:15.696: I/System.out(7480): no
07-21 16:26:15.761: I/System.out(7480): yes
07-21 16:26:15.796: I/System.out(7480): no
07-21 16:26:15.841: I/System.out(7480): no
07-21 16:26:15.896: I/System.out(7480): no
07-21 16:26:15.961: I/System.out(7480): no
07-21 16:26:16.046: I/System.out(7480): no
07-21 16:26:16.111: I/System.out(7480): no
07-21 16:26:16.161: I/System.out(7480): no
07-21 16:26:16.181: I/System.out(7480): no
07-21 16:26:16.211: I/System.out(7480): no
07-21 16:26:16.241: I/System.out(7480): no
07-21 16:26:16.276: I/System.out(7480): no
07-21 16:26:16.311: I/System.out(7480): no
07-21 16:26:16.341: I/System.out(7480): no
07-21 16:26:16.376: I/System.out(7480): no
07-21 16:26:16.426: I/System.out(7480): no
07-21 16:26:16.476: I/System.out(7480): no
07-21 16:26:16.526: I/System.out(7480): yes
07-21 16:26:16.611: I/System.out(7480): no
07-21 16:26:16.696: I/System.out(7480): no
07-21 16:26:16.846: I/System.out(7480): no

I have a custom listview wich have certain element in it. everything work! only this one i don't know why? any suggestion/

2 Answers2

0

use equals or equalsIgnoreCase to compare strings. the == operator compares the string`s reference

for instance:

String a = "astring";
if (a.equals("astring")) {

}
Blackbelt
  • 156,034
  • 29
  • 297
  • 305
0

== compares object by reference.

To find out whether two different String instances hold the same value, call equals().

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964