I am hitting a huge wall here. I got this code which checks on database result :
chosenSlotDAO.open();
Log.d("id", chosenSlotDAO.getId());
Log.d("isParked", chosenSlotDAO.getIsParked());
Log.d("parkedRow", chosenSlotDAO.getParkedRow());
Log.d("selectedSlot", chosenSlotDAO.getSelectedSlot());
String idStatus = chosenSlotDAO.getId();
String isParkedStatus = chosenSlotDAO.getIsParked();
String parkedRowStatus = chosenSlotDAO.getParkedRow();
String selectedSlotStatus = chosenSlotDAO.getSelectedSlot();
final String outputA = this.getOutput(this, slotA);
if(idStatus == id && isParkedStatus == isParked && parkedRowStatus != parkedA && selectedSlotStatus != slotA)
{
arriveTView.setText(alreadyParked + chosenSlotDAO.getParkedRow());
}
else if(idStatus == id && isParkedStatus == isNotParked && parkedRowStatus != parkedA && selectedSlotStatus != slotA)
{
Toast.makeText(getApplicationContext(),
wrongParkingRow,
Toast.LENGTH_LONG).show();
chosenSlotDAO.updateSlot(id, slotA, parkedA, isParked);
}
else if(idStatus == id && isParkedStatus == isParked && parkedRowStatus == parkedA && selectedSlotStatus == slotA)
{
chosenSlotDAO.updateSlot(id, slotA, setEmpty, isNotParked);
dbUpdateAdd.execute(slotA);
Intent myIntent = new Intent(ParkAArrive.this, ParkLeaving.class);
ParkAArrive.this.startActivity(myIntent);
}
else if(outputA.isEmpty())
{
arriveTView.setText(isFull);
}
else
{
Toast.makeText(getApplicationContext(),
nowParked,
Toast.LENGTH_LONG).show();
chosenSlotDAO.updateSlot(id, slotA, parkedA, isParked);
arriveTView.setText(chosenSlotDAO.getSelectedSlot());
dbUpdate.execute(slotA);
}
The class is started by tapping an NFC tag.
LogCat returns :
06-15 04:35:10.818: D/id(12294): 1
06-15 04:35:10.818: D/isParked(12294): 1
06-15 04:35:10.819: D/parkedRow(12294): ParkedA
06-15 04:35:10.819: D/selectedSlot(12294): SlotA
06-15 04:35:10.829: D/link(12294): http://parkit.byethost9.com/db_show_slot.php?slot_name=SlotA
06-15 04:35:11.681: D/line(12294): 14
It clearly shows that user is parked, parkedRow is ParkedA, and SlotA is SlotA. But the if
does not work.
But when I start the activity again, nothing except
else if(outputA.isEmpty())
{
arriveTView.setText(isFull);
}
else
{
Toast.makeText(getApplicationContext(),
nowParked,
Toast.LENGTH_LONG).show();
chosenSlotDAO.updateSlot(id, slotA, parkedA, isParked);
arriveTView.setText(chosenSlotDAO.getSelectedSlot());
dbUpdate.execute(slotA);
}
works.
Where in the code am I doing wronggg?? Tell me if I left any required info untold..
UPDATE :
It seems that I need to change my code so that it can compare String
, and yes it's the problem I'm facing.