Roomに関する不具合を修正
This commit is contained in:
parent
6fc1e6daa5
commit
4dfc928571
|
@ -3,7 +3,7 @@ package com.example.oplogy;
|
|||
import androidx.room.Database;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
@Database(entities = {SetUpTable.class}, version = 1)
|
||||
@Database(entities = {SetUpTable.class}, version = 2)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
// データベースにアクセスするためのメソッドを提供する
|
||||
public abstract SetUpTableDao setUpTableDao();
|
||||
|
|
|
@ -70,13 +70,13 @@ public class CreateRoot {
|
|||
}
|
||||
|
||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
executor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
||||
String startTime=setUpTableDao.getStartTime();
|
||||
Log.d("CreateRoot", "開始時間" + startTime);
|
||||
}
|
||||
executor.execute(() -> {
|
||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
||||
String startTime=setUpTableDao.getStartTime();
|
||||
String endTime=setUpTableDao.getEndTime();
|
||||
Log.d("CreateRoot", "開始時間" + startTime);
|
||||
Log.d("CreateRoot", "終了時刻" + endTime);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||
|
||||
import com.google.firebase.firestore.FirebaseFirestore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
@ -92,14 +91,10 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
}
|
||||
// ルート作成のクリック処理
|
||||
if (view == root) {
|
||||
//CreateRootにmyDataListを渡す
|
||||
imageRoot.setImageResource(R.drawable.pin);
|
||||
List<MyDataClass> myDataList = firestoreReception.getMyDataList();
|
||||
CreateRoot createRoot = new CreateRoot(MainActivity.this);
|
||||
createRoot.receiveData(myDataList);
|
||||
Intent toRoot = new Intent(MainActivity.this, CreateRoot.class);
|
||||
toRoot.putExtra("myDataList", (ArrayList<MyDataClass>) myDataList);
|
||||
startActivity(toRoot);
|
||||
|
||||
}
|
||||
// 提出状況のクリック処理
|
||||
|
|
|
@ -19,7 +19,6 @@ import androidx.fragment.app.FragmentActivity;
|
|||
import androidx.room.Room;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
@ -125,7 +124,9 @@ public class SetUpActivity extends FragmentActivity
|
|||
getApplicationContext(),
|
||||
AppDatabase.class,
|
||||
"SetUpTable"
|
||||
).build();
|
||||
)
|
||||
.fallbackToDestructiveMigration()
|
||||
.build();
|
||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
||||
// Roomの操作を行う
|
||||
SetUpTable setUpTable = new SetUpTable(
|
||||
|
|
|
@ -9,22 +9,24 @@ public class SetUpTable {
|
|||
public int id;
|
||||
public String teacherName;
|
||||
public String startPoint;
|
||||
public String endPoint;
|
||||
public String startTime;
|
||||
public String endTime;
|
||||
public String breakStartTime;
|
||||
public String breakEndTime;
|
||||
public String intervalTime;
|
||||
public String startBreakTime;
|
||||
public String endBreakTime;
|
||||
public int totalStudent;
|
||||
|
||||
|
||||
//コンストラクタ
|
||||
public SetUpTable(String teacherName, String startPoint, String endPoint, String startTime, String endTime, String breakStartTime,String breakEndTime, int totalStudent) {
|
||||
public SetUpTable(String teacherName, String startPoint, String startTime, String endTime,
|
||||
String intervalTime, String startBreakTime, String endBreakTime, int totalStudent) {
|
||||
this.teacherName = teacherName;
|
||||
this.startPoint = startPoint;
|
||||
this.endPoint = endPoint;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.breakStartTime = breakStartTime;
|
||||
this.breakEndTime = breakEndTime;
|
||||
this.intervalTime = intervalTime;
|
||||
this.startBreakTime = startBreakTime;
|
||||
this.endBreakTime = endBreakTime;
|
||||
this.totalStudent = totalStudent;
|
||||
}
|
||||
//getter
|
||||
|
@ -37,21 +39,12 @@ public class SetUpTable {
|
|||
public String getStartPoint() {
|
||||
return startPoint;
|
||||
}
|
||||
public String getEndPoint() {
|
||||
return endPoint;
|
||||
}
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
public String getBreakStartTime() {
|
||||
return breakStartTime;
|
||||
}
|
||||
public String getBreakEndTime() {
|
||||
return breakEndTime;
|
||||
}
|
||||
public int getTotalStudent() {
|
||||
return totalStudent;
|
||||
}
|
||||
|
@ -65,21 +58,12 @@ public class SetUpTable {
|
|||
public void setStartPoint(String startPoint) {
|
||||
this.startPoint = startPoint;
|
||||
}
|
||||
public void setEndPoint(String endPoint) {
|
||||
this.endPoint = endPoint;
|
||||
}
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
public void setBreakStartTime(String breakStartTime) {
|
||||
this.breakStartTime = breakStartTime;
|
||||
}
|
||||
public void setBreakEndTime(String breakEndTime) {
|
||||
this.breakEndTime = breakEndTime;
|
||||
}
|
||||
public void setTotalStudent(int totalStudent) {
|
||||
this.totalStudent = totalStudent;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user