'How to retrive as custom object using Firebase RTDB

public class FireStoreData  {

private String brgy;
private String street;
private String date;
private String  time;
private GeoPoint location;
private String item;


public FireStoreData(){

}

public FireStoreData(String brgy, String street, String date, String time, GeoPoint location, String item) {
    .....
}

...

Here is my database my database structure

This is my code for retrieving data

 databaseReference = FirebaseDatabase.getInstance().getReference();
    databaseReference.child( "CrimeReport" ).get().addOnCompleteListener( new OnCompleteListener<DataSnapshot>() {
        @Override
        public void onComplete(@NonNull Task<DataSnapshot> task) {
            if (!task.isSuccessful()) {

                Log.e("firebase", "Error getting data", task.getException());
            }
            else {


                Toast.makeText( requireContext(), "Data"+ task.getResult().getValue(), Toast.LENGTH_SHORT ).show();
                Log.d("firebase", String.valueOf(task.getResult().getValue()));
            }
        }
    } );

This is the received data.

 {Palatie={Robbery={Report={date=02/28/22, item=Robbery, street=Santos, location={latitude=14.561677776545071, longitude=121.08633846044542}, time=12:0 AM, brgy=Palatie}}, Hijacking={Report={date=02/23/22, item=Hijacking, street=Santos, location={latitude=14.561677776545071, longitude=121.08633846044542}, time=12:0 AM, brgy=Palatie}}}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source