I need to Assign the value into id and check how many item will be there like 0 , 1 ,2 or more than 3 like wise. I Put a photo of a result outputs to understand better. I couldn't understand about the getting the values like a row and comparing ? Anybody can give me a help ? Thank you
For Loop
for (int i = 0; i < parentID.size(); i++) //21 time check - each category id check with all product
{
Log.i("ParentID",""+parentID);
Log.i("ProductResponse",""+Product);
for (ImagesResponse chk : Product) {
Log.i("CategotyID_Check", "" + parentID.get(i)); // Main Cateogry ID will display
Log.i("ParentID_Product", "" + chk.getParent_category_id()); // Parent ID of
Proucts
if (parentID.get(i).equals(chk.getParent_category_id())) {
Toast.makeText(MainActivity.this, "Product PID Equals ",
Toast.LENGTH_SHORT).show();
Log.i("ProductCorrect", "ParentID = " + parentID.get(i));
Log.i("ImageUrl",""+chk.getProductImageName());
counts.add(parentID.get(i));
count++;
id = Integer.parseInt(parentID.get(i));
PID = String.valueOf(parentID.get(i));
Log.i("assign id",""+id);
Log.i("c",""+(PID=="0"));
if(id == 0){
Log.i("values-0","");
// hide all textfileds and images
// productdescription.setVisibility(View.GONE);
// productdescription2.setVisibility(View.GONE);
// productprice.setVisibility(View.GONE);
// productprice2.setVisibility(View.GONE);
}
if(id == 1){
//display the product and text in image box 1 and textfileds 1
Log.i("Values-1",""+id);
}
if (id == 2){
//display the product images and texts in 1 and 2
Log.i("Values-1",""+id);
}
if(id > 3 ){
//display the first two products
}
else{
Log.i("Something-Error",""+id);
}
}
else if (parentID.get(i) == null) {
Toast.makeText(MainActivity.this, "Product PID is NULL",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, "Not Equal", Toast.LENGTH_SHORT).show();
}
}
}
Aucun commentaire:
Enregistrer un commentaire