My searching part of code:
String neededShop = "not found";
float min_price=999999;
ProductHandler ph = new ProductHandler(this);
prod=ph.getAllProducts();
for(int i = 0 ; i<prod.size(); i++)
{
if(prod.get(i).getName()==SearchProduct)
{
if(min_price>prod.get(i).getPrice())
{
min_price=prod.get(i).getPrice();
neededShop = prod.get(i).getShop();
}
}
}
in this part: if(prod.get(i).getName()==SearchProduct)
prod [0] name "Cat" (id=830032142800)
SearchProduct "Cat" (id=830032120832)
When it is comparing it returns false, in spite of they are similar. Any ideas why?