如果 value= x 我想改变 imageview 的可见性
但我在 Eclipse 上有错误消息。
这是我的java的一部分
if (success == 1) {
// products found
// Getting Array of Products
products = json.getJSONArray(TAG_PRODUCTS);
// looping through All Products
for (int i = 0; i < products.length(); i++) {
JSONObject c = products.getJSONObject(i);
// Storing each json item in variable
String id = c.getString(TAG_PID);
String name = c.getString(TAG_NAME);
String price = c.getString(TAG_PRICE);
String cu = c.getString(TAG_CU);
/////////////
///HERE THE BUG////
if (cu == "1"){
cu = "oui";
}
else {
ImageView image_A_wrong = (ImageView) findViewById(R.id.imageView1);
image_A_wrong.setVisibility(View.GONE);
}
这里是我的 xml 文件
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/quo100px"
android:visibility="gone" />
tks提前为您提供帮助