El LogCat me arroja este error:
03-06 14:09:42.618 1933-1933/com.example.usuario.app.myroodent E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.usuario.app.myroodent, PID: 1933
java.lang.IllegalArgumentException: argument 1 should have type java.sql.Timestamp, got java.util.Date
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.google.firebase.firestore.g.zzg$zza.zza(com.google.firebase:firebase-firestore@@17.0.5:690)
at com.google.firebase.firestore.g.zzg$zza.zza(com.google.firebase:firebase-firestore@@17.0.5:658)
at com.google.firebase.firestore.g.zzg.zzd(com.google.firebase:firebase-firestore@@17.0.5:487)
at com.google.firebase.firestore.g.zzg.zza(com.google.firebase:firebase-firestore@@17.0.5:226)
at com.google.firebase.firestore.g.zzg.zza(com.google.firebase:firebase-firestore@@17.0.5:81)
at com.google.firebase.firestore.DocumentSnapshot.toObject(com.google.firebase:firebase-firestore@@17.0.5:175)
at com.google.firebase.firestore.QueryDocumentSnapshot.toObject(com.google.firebase:firebase-firestore@@17.0.5:97)
at com.google.firebase.firestore.DocumentSnapshot.toObject(com.google.firebase:firebase-firestore@@17.0.5:156)
at com.google.firebase.firestore.QueryDocumentSnapshot.toObject(com.google.firebase:firebase-firestore@@17.0.5:78)
at com.example.usuario.app.myroodent.EspeciesActivity$1.onEvent(EspeciesActivity.java:57)
at com.example.usuario.app.myroodent.EspeciesActivity$1.onEvent(EspeciesActivity.java:47)
at com.google.firebase.firestore.zzi.onEvent(com.google.firebase:firebase-firestore@@17.0.5:1834)
at com.google.firebase.firestore.g.zzh.zza(com.google.firebase:firebase-firestore@@17.0.5:28)
at com.google.firebase.firestore.g.zzi.run(com.google.firebase:firebase-firestore@@17.0.5)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5019)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Esta es mi actividad EspeciesActivity donde me genera el error:
public class EspeciesActivity extends RegistrosActivity {
private static final String TAG = "FireLog";
private RecyclerView mMainList;
private FirebaseFirestore mFirestore;
private AvistAdapter avistAdapter;
private List<ReporteEspecie> reportesEspecies;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_especies);
reportesEspecies = new ArrayList<>();
avistAdapter = new AvistAdapter(reportesEspecies);
mMainList = (RecyclerView) findViewById(R.id.main_list);
mMainList.setHasFixedSize(true);
mMainList.setLayoutManager(new LinearLayoutManager(this));
mMainList.setAdapter(avistAdapter);
mFirestore = FirebaseFirestore.getInstance();
mFirestore.collection("reportes").addSnapshotListener(new EventListener<QuerySnapshot>() {
@Override
public void onEvent(QuerySnapshot documentSnapshots,FirebaseFirestoreException e) {
if(e !=null){
Log.d(TAG, "Error: "+e.getMessage());
}
for (DocumentChange doc : documentSnapshots.getDocumentChanges()){
if(doc.getType()== DocumentChange.Type.ADDED){
ReporteEspecie reporteEspecie = doc.getDocument().toObject(ReporteEspecie.class);
reportesEspecies.add(reporteEspecie);
avistAdapter.notifyDataSetChanged();
}
}
}
});
}
}
Agrego Activity ReporteEspecie.java
public class ReporteEspecie {
String email,direccion,especie,nombre;
Timestamp fechaYhora;
public ReporteEspecie(){
}
public ReporteEspecie(String email, String direccion, String especie, String nombre, Timestamp fechaYhora) {
this.email = email;
this.direccion = direccion;
this.especie = especie;
this.nombre = nombre;
this.fechaYhora = fechaYhora;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getDireccion() {
return direccion;
}
public void setDireccion(String direccion) {
this.direccion = direccion;
}
public String getEspecie() {
return especie;
}
public void setEspecie(String especie) {
this.especie = especie;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public Timestamp getFechaYhora() {
return fechaYhora;
}
public void setFechaYhora(Timestamp fechaYhora) {
this.fechaYhora = fechaYhora;
}
}