Android Open Source - ExpertAndroid Main Object

From Project

Back to project page ExpertAndroid.


The source code is released under:

MIT License

If you think the Android project ExpertAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.iuriio.demos.expertandroid.ch4gsonserialization;
/*from   w w w .  j  a va2s .  c  om*/
import java.util.ArrayList;

public class MainObject
    public int intValue = 5;
    public String strinValue = "st<ri>\"ng\"Value<node1>test</node2>";
    public String[] stringArray;
    public ArrayList<ChildObject> childList = new ArrayList<ChildObject>();

    public void addChild(ChildObject co)

    public void populateStringArray()
        stringArray = new String[2];
        stringArray[0] = "first";
        stringArray[1] = "second";
    public static MainObject createTestMainObject()
        MainObject mo = new MainObject();
        mo.addChild(new ChildObject("Adam",30));
        mo.addChild(new ChildObject("Eve",28));
        return mo;
    public static String checkTestMainObject(MainObject mo)
        MainObject moCopy = createTestMainObject();
        if (!(mo.strinValue.equals(moCopy.strinValue)))
            return "String values don't match:" + mo.strinValue;
        if (mo.childList.size() != moCopy.childList.size())
            return "array list size doesn't match";
        //get first child
        ChildObject firstChild = mo.childList.get(0);
        ChildObject firstChildCopy = moCopy.childList.get(0);
        if (!
            return "first child name doesnt match";
        return "everything matches";


Java Source Code List