GeoCoder.classへの遷移を後に変更
FirestoreReception.javaから直接 CreateRoot.javaにmyDataListを渡すコードに
This commit is contained in:
parent
507cfc739c
commit
79042493f6
|
@ -2,28 +2,17 @@ package com.example.oplogy;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.android.gms.maps.model.LatLng;
|
import java.util.List;
|
||||||
import com.google.firebase.Timestamp;
|
|
||||||
|
|
||||||
public class CreateRoot {
|
public class CreateRoot {
|
||||||
private String address;
|
public void receiveData(List<MyDataClass> myDataList) {
|
||||||
private Timestamp startTimestamp;
|
|
||||||
private Timestamp endTimestamp;
|
// デバッグ用ログ
|
||||||
private long studentNumber;
|
for(MyDataClass data : myDataList){
|
||||||
private LatLng latLng;
|
Log.d("CreateRoot", "data: "+ data.toString());
|
||||||
|
}
|
||||||
|
Log.d("CreateRoot", "myDataList[0]: " + myDataList.get(0).toString());
|
||||||
|
|
||||||
public void receiveData(String address, Timestamp startTimestamp, Timestamp endTimestamp, long studentNumber, LatLng latLng) {
|
|
||||||
this.address = address;
|
|
||||||
this.startTimestamp = startTimestamp;
|
|
||||||
this.endTimestamp = endTimestamp;
|
|
||||||
this.studentNumber = studentNumber;
|
|
||||||
this.latLng = latLng;
|
|
||||||
|
|
||||||
// 受け取ったデータを利用してログを出力
|
|
||||||
Log.d("CreateRoot", "address: " + address);
|
|
||||||
Log.d("CreateRoot", "startTimestamp: " + startTimestamp);
|
|
||||||
Log.d("CreateRoot", "endTimestamp: " + endTimestamp);
|
|
||||||
Log.d("CreateRoot", "studentNumber: " + studentNumber);
|
|
||||||
Log.d("CreateRoot", "latLng: " + latLng);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -58,10 +58,14 @@ public class FirestoreReception {
|
||||||
//リストに追加
|
//リストに追加
|
||||||
myDataList.add(myData);
|
myDataList.add(myData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//取得したデータをログ表示
|
//取得したデータをログ表示
|
||||||
for(MyDataClass data :myDataList){
|
for(MyDataClass data :myDataList){
|
||||||
Log.i("FirestoreReceptiond", "data: " + data.toString());
|
Log.i("FirestoreReceptiond", "data: " + data.toString());
|
||||||
}
|
}
|
||||||
|
CreateRoot createRoot=new CreateRoot();
|
||||||
|
createRoot.receiveData(myDataList);
|
||||||
} else {
|
} else {
|
||||||
Log.w("FirestoreReceptiond", "Error getting documents.", task.getException());
|
Log.w("FirestoreReceptiond", "Error getting documents.", task.getException());
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,11 +36,6 @@ public class GeoCoder {
|
||||||
Log.d("FirestoreReception", "studentNumber: " + studentNumber);
|
Log.d("FirestoreReception", "studentNumber: " + studentNumber);
|
||||||
Log.d("FirestoreReception", "latLng: "+latLng );
|
Log.d("FirestoreReception", "latLng: "+latLng );
|
||||||
|
|
||||||
// CreateRootクラスのインスタンスを作成
|
|
||||||
CreateRoot createRoot = new CreateRoot();
|
|
||||||
// データを渡す
|
|
||||||
createRoot.receiveData(address.get(0), firstDay.get(0), firstDay.get(1), studentNumber, latLng);
|
|
||||||
|
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
Log.e("NullPointerException", "getの中身がnull" + e);
|
Log.e("NullPointerException", "getの中身がnull" + e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,4 +39,61 @@ public class MyDataClass {
|
||||||
", secondDay=" + secondDay +
|
", secondDay=" + secondDay +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//getter
|
||||||
|
public String getPatronName() {
|
||||||
|
return patronName;
|
||||||
|
}
|
||||||
|
public int getClassId() {
|
||||||
|
return classId;
|
||||||
|
}
|
||||||
|
public List<String> getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
public List<Timestamp> getFirstDay() {
|
||||||
|
return firstDay;
|
||||||
|
}
|
||||||
|
public int getStudentNumber() {
|
||||||
|
return studentNumber;
|
||||||
|
}
|
||||||
|
public String getChildName() {
|
||||||
|
return childName;
|
||||||
|
}
|
||||||
|
public List<Timestamp> getThirdDay() {
|
||||||
|
return thirdDay;
|
||||||
|
}
|
||||||
|
public List<Timestamp> getSecondDay() {
|
||||||
|
return secondDay;
|
||||||
|
}
|
||||||
|
public double getLatitude() {
|
||||||
|
return latitude;
|
||||||
|
}
|
||||||
|
//setter
|
||||||
|
public void setPatronName(String patronName) {
|
||||||
|
this.patronName = patronName;
|
||||||
|
}
|
||||||
|
public void setClassId(int classId) {
|
||||||
|
this.classId = classId;
|
||||||
|
}
|
||||||
|
public void setAddress(List<String> address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
public void setFirstDay(List<Timestamp> firstDay) {
|
||||||
|
this.firstDay = firstDay;
|
||||||
|
}
|
||||||
|
public void setStudentNumber(int studentNumber) {
|
||||||
|
this.studentNumber = studentNumber;
|
||||||
|
}
|
||||||
|
public void setChildName(String childName) {
|
||||||
|
this.childName = childName;
|
||||||
|
}
|
||||||
|
public void setThirdDay(List<Timestamp> thirdDay) {
|
||||||
|
this.thirdDay = thirdDay;
|
||||||
|
}
|
||||||
|
public void setSecondDay(List<Timestamp> secondDay) {
|
||||||
|
this.secondDay = secondDay;
|
||||||
|
}
|
||||||
|
public void setLatitude(double latitude) {
|
||||||
|
this.latitude = latitude;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user