Note that there are some explanatory texts on larger screens.

plurals
  1. POContentValues() incorrectly adding values
    primarykey
    data
    text
    <p>I'm using the following code to fill up a ContentValues variable.</p> <pre><code>public ContentValues getContentValues() { ContentValues initialValues = new ContentValues(); initialValues.put("blt_name", m_name); initialValues.put("blt_pictureURI", m_pictureURI); initialValues.put("blt_description", m_description); initialValues.put("blt_UUID", getUUID().toString()); return initialValues; } </code></pre> <p>My problem is that put() is putting the UUID and the name in the same hash location! I have no idea why. When creating the initialValues variable it creates an internal hashmap having 7 slots. When putting the values, key is added in slot 0, name is ALSO added in slot 0 (overwriting uuid), pic is added in slot 3 and desc is added in slot 7.</p> <p>All four keys are, of course, different values, declared as final Strings.</p> <p>I tried <em>new ContentValues(4)</em> in order to force them into the right spot, that was worse. 2 values were overwritten. </p> <p>[Edit] I just tried changing the order of the puts. By moving the UUID so that it is put() last, it still overwrites slot 0 in hashmap. (I know what you are thinking, and YES the keys are unique.)</p> <p>[EDIT] I tried it with the following code, and it works perfectly. I'm at a lost. I also edited the original question because I tried it with hard coded strings, and that didn't work either.</p> <pre><code> initialValues.put("a", m_name); initialValues.put("b", m_pictureURI); initialValues.put("c", m_description); initialValues.put("d", getUUID().toString()); </code></pre> <p>Any help would be appreciated,</p> <p>-I_Artist</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload