Hashmap Object Parsing String into long or int
<p>I am trying to populate a ListView with an Object. I am getting an error</p>

<p>"java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long"</p>

<p>The data that I am pulling out of my web database is a String and its trying to place it into a long. I understand why I get the error and where I'm getting the error but I don't know how to fix it.</p>

<p>Here is my object:</p>

<pre><code>public static Person createFromGenericMap(Map&lt;String, Object&gt; object) {

        Person p = new Person();

        p.personID = (long) object.get("personID");
        p.phoneNumber = (int) object.get("phone");
        return p;
    }
</code></pre>

<p>and here is where I think the problem is:</p>

<pre><code>ArrayList&lt;Person&gt; people = new ArrayList&lt;&gt;();

            for (Map&lt;String, Object&gt; personObject : objects) {
                Person p = Person.createFromGenericMap(personObject);
                people.add(p);
            }
</code></pre>

<p>Update: Its pulling all the information from my web database correctly but the issue is still in the long to string. </p>

<p>LOGS:</p>

<p>05-09 22:53:18.098 2147-2147/com.f0xcr4f7.intelwatch D/Kumulos Client: [{lastName=Johnson, middleName=Steven, firstName=Drake, dob=153446400, address=2312 W Lakeview, Waco, TX 72015, phone=2147483647, dl=765432345, ss=435097656, personID=1, timeCreated=2016-03-30 16:41:00, timeUpdated=2016-04-10 02:40:48, race=w, sex=m, age=43, 05-09 22:53:18.102 2147-2147/com.f0xcr4f7.intelwatch E/AndroidRuntime: FATAL EXCEPTION: main</p>

<pre><code>                                                                   java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference
</code></pre>