Android/Firebase - Can't convert object of type java.util.ArrayList to type **my object**
<p>I'm trying to get the values of each node under "templates."</p>

<p><a href="https://i.stack.imgur.com/kharN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kharN.png" alt="enter image description here"></a></p>

<p>For example, "eght" (just random test name), contains an ArrayList of ArrayLists. So, ArrayList&lt;.ArrayList>.</p>

<p>I just need to get the values once, so I'm using a single event listener:</p>

<pre><code>mTemplateRef.addListenerForSingleValueEvent(
     new ValueEventListener() {
     @Override
     public void onDataChange(DataSnapshot dataSnapshot) {

          for(DataSnapshot templateSnapshot : dataSnapshot.getChildren()){

               // I've tried a million different things here, but all result in the error
              // This is the error line
              MapFoo mapFoo = templateSnapshot.getValue(MapFoo.class);
                    }
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    Log.w(TAG, "getUser:onCancelled", databaseError.toException());
                    // ...
                }
            });
</code></pre>

<p>I always end up with this: </p>

<pre><code>Can't convert object of type java.util.ArrayList to type com.appname.template_editor.MapFoo
</code></pre>

<p>The last part being any object I try. </p>

<p>Here's MapFoo:</p>

<p>By the way, I"m using a Map because when I debug, the nodes seem to be in HashMap form. I've also tried a HashMap object with the same error. I've also tried several other objects to try to make it work with no success. </p>

<pre><code>public class MapFoo {
public Map&lt;String, ArrayList&gt; mapList;

public MapFoo(){

}

public Map getMapList(){
    return mapList;
}

public MapFoo(Map&lt;String, ArrayList&gt; mapList){
    this.mapList = mapList;
}
</code></pre>

<p>}</p>

<p>Another variation I tried: </p>

<pre><code>public class MasterListTemplateClass {

public String templateName;
public ArrayList&lt;ArrayList&gt; arrayList;

public MasterListTemplateClass() {
}

public MasterListTemplateClass(String templateName, ArrayList&lt;ArrayList&gt; arrayList) {
    this.templateName = templateName;
    this.arrayList = arrayList;
}

public String getName() {
    return templateName;
}

public ArrayList&lt;ArrayList&gt; getList() {
    return arrayList;
}
</code></pre>

<p>}</p>

<p>I just can't get any of this to work. I simply need the values in my database!</p>