したがって、ボタンを押すと実行されるメソッドがあり、内部の if/else if/else ループが少しある場合を除いて、すべてが完璧になります。私が行方不明になっているのはばかげていると確信していますが、それを見ることができないようです。
以下のコードでは、hourtype を見つけていますが、直接 false に設定しても、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;
}