datePicker #40
|
@ -10,6 +10,7 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.Button;
|
||||
import android.widget.DatePicker;
|
||||
|
@ -131,10 +132,25 @@ public class SetUpActivity extends FragmentActivity
|
|||
Log.d(TAG, "Interval Time" + intervalTime);
|
||||
Log.d(TAG, "Start Break Time" + startBreakTime);
|
||||
Log.d(TAG, "End Break Time" + endBreakTime);
|
||||
totalStudent = Integer.parseInt(textViewTotalStudent.getText().toString()); //数値型に変更
|
||||
Log.d(TAG, "Total Student" + totalStudent);
|
||||
Log.d(TAG, "onClick: できてるよ");
|
||||
|
||||
// クラスの人数を数値に変換して取得
|
||||
try {
|
||||
totalStudent = Integer.parseInt(textViewTotalStudent.getText().toString());
|
||||
} catch (NumberFormatException e) {
|
||||
totalStudent = 0; // デフォルト値を設定するか、エラー処理を追加することも考慮する必要があります
|
||||
}
|
||||
|
||||
// 入力データのバリデーション
|
||||
if (TextUtils.isEmpty(teacherName) || TextUtils.isEmpty(startPoint) || TextUtils.isEmpty(startTime)
|
||||
|| TextUtils.isEmpty(firstDay) || TextUtils.isEmpty(secondDay) || TextUtils.isEmpty(thirdDay)
|
||||
|| TextUtils.isEmpty(endTime) || TextUtils.isEmpty(intervalTime) || TextUtils.isEmpty(startBreakTime)
|
||||
|| TextUtils.isEmpty(endBreakTime) || totalStudent <= 0) {
|
||||
Toast.makeText(SetUpActivity.this, "必須項目を入力してください", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// データベースへの登録処理
|
||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
|
@ -229,9 +245,14 @@ public class SetUpActivity extends FragmentActivity
|
|||
reset.setOnClickListener(v -> { //テキストとラジオボタンの選択を消去
|
||||
textViewTeacherName.setText("");
|
||||
textViewStartPoint.setText("");
|
||||
buttonFirstDay.setText("");
|
||||
buttonSecondDay.setText("");
|
||||
buttonThirdDay.setText("");
|
||||
radioButtonTenMinute.setChecked(false);
|
||||
radioButtonFifteenMinute.setChecked(false);
|
||||
radioButtonThirtyMinute.setChecked(false);
|
||||
textViewStartTime.setText("");
|
||||
textViewEndTime.setText("");
|
||||
textViewStartBreakTime.setText("");
|
||||
textViewEndBreakTime.setText("");
|
||||
textViewTotalStudent.setText("");
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
android:id="@+id/setFirstDayButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/firstDay"
|
||||
android:hint="@string/firstDay"
|
||||
android:layout_marginStart="7sp"
|
||||
android:layout_marginEnd="7sp"
|
||||
tools:ignore="DuplicateIds" />
|
||||
|
@ -118,7 +118,7 @@
|
|||
android:id="@+id/setSecondDayButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/secondDay"
|
||||
android:hint="@string/secondDay"
|
||||
android:layout_marginStart="7sp"
|
||||
android:layout_marginEnd="7sp"
|
||||
tools:ignore="DuplicateIds" />
|
||||
|
@ -127,7 +127,7 @@
|
|||
android:id="@+id/setThirdDayButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/threeDay"
|
||||
android:hint="@string/threeDay"
|
||||
android:layout_marginStart="7sp"
|
||||
android:layout_marginEnd="7sp"
|
||||
tools:ignore="DuplicateIds" />
|
||||
|
|
Loading…
Reference in New Issue
Block a user