mercredi 22 juin 2016

Retrieve firebase hashmap data in POJO

I used an ArrayList to store data on Firebase.It got stored as a HashMap with key value starting from 0 and its value stored as string.

The database is as follows:

enter image description here

I am using POJO, to store and retrieve data.

My POJO is defined as follow:

@JsonIgnoreProperties(ignoreUnknown = true)
public class POJO_MemoriesRVDisplay {
    String mem_name;
    String mem_place_street_address;
    HashMap<Object,Object> images;

    public POJO_MemoriesRVDisplay() {
    }

    public HashMap<Object, Object> getImages() {
        return images;
    }

    public void setImages(HashMap<Object, Object> images) {
        this.images = images;
    }

    public POJO_MemoriesRVDisplay(String mem_name, String mem_place_street_address, HashMap<Object, Object> images) {
        this.mem_name = mem_name;
        this.mem_place_street_address = mem_place_street_address;
        this.images = images;
    }

    public String getMem_name() {
        return mem_name;
    }

    public void setMem_name(String mem_name) {
        this.mem_name = mem_name;
    }

    public String getMem_place_street_address() {
        return mem_place_street_address;
    }

    public void setMem_place_street_address(String mem_place_street_address) {
        this.mem_place_street_address = mem_place_street_address;
    }
}

When I run this code, I get an error such as:

Failed to bounce to type

How do I declare the POJO properly. I have tried several posts but couldn't help it. Tried changing the declaration of images to strings, still wouldn't work. Please help!

Aucun commentaire:

Enregistrer un commentaire