捕所以我有一個按鈕上按運行的方法,一切都來了完善的,除非我有一點內部的if/else if/else語句循環。我確信這是我失蹤的愚蠢,但我似乎無法看到它。的if/else裏面沒有方法按下按鈕
在下面的代碼我找到了尋找hourtype但即使我直接將其設置爲假的if/else不會觸發。它能夠得到小時int很好,但它不會像它應該減去12。
我知道我沒有在這裏指定的日期類型,因爲我這樣做,前面已經上。這不是問題。就像我說的,我敢肯定,我錯過了一些愚蠢的東西,因爲我一直盯着它太久。這裏的方法:
public String enterMood(View v) {
try {
int month = dPick.getMonth();
int day = dPick.getDayOfMonth();
int year = dPick.getYear();
int minute = tPick.getCurrentMinute();
String moodAntePost = "AM";
hourType = tPick.is24HourView();
moodHour = tPick.getCurrentHour();
if (hourType = false) { // Not hitting this point for some reason I
// can't fathom.
if (moodHour > 12) {
moodHour = (moodHour - 12);
moodAntePost = "PM";
}
} else if (hourType = false) {
if (moodHour <= 0) {
moodHour = 12;
}
} else {
}
String noteText = noteField.getText().toString();
Mood = "Happiness," + happyValue + ",Energy," + energyValue
+ ",Anxiety," + anxietyValue + ",Pain," + painValue
+ ",Date," + month + "/" + day + "/" + year + ",Time,"
+ moodHour + ":" + minute + "," + moodAntePost + ",Note,"
+ noteText;
System.out.println(Mood); //Just to print to the LogCat
} catch (Exception buttonListenerException) {
Log.e(TAG, "Exception received", buttonListenerException);
}
return Mood;
}
謝謝你了。這是問題所在。我現在覺得自己像個白癡。 *微笑* – fauxfire76 2013-02-28 14:32:10