-3
我在這裏打了一堵巨大的牆。我得到了這個代碼檢查數據庫結果:Android - 如果然後不工作..?
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);
}
該類是通過點擊NFC標籤啓動的。
logcat的回報:
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
它清楚地表明該用戶被停,parkedRow是ParkedA和SlotA是SlotA。但if
不起作用。
但是,當我再次開始活動,沒有什麼不同之處
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);
}
作品。
在代碼中我做錯了什麼?告訴我,如果我留下任何所需的信息untold ..
更新: 似乎我需要更改我的代碼,以便它可以比較String
,是的這是我面臨的問題。
您應該重新表達您的問題。 – AnixPasBesoin