Note that there are some explanatory texts on larger screens.

plurals
  1. POSQlite database not storing double value as string
    primarykey
    data
    text
    <p>I am using following code</p> <pre><code> public boolean addArea(AreaClass area , ArrayList&lt;AreaMarkClass&gt; areaArray) { area.id = getNextAreaId(); Log.d("longitude", area.longitude); Log.d("latitude", area.latitude); ContentValues initialValues = new ContentValues(); initialValues.put("_id", area.id); initialValues.put("name", area.name); initialValues.put("longitude", area.longitude); initialValues.put("latitude", area.latitude); initialValues.put("zoomLevel", area.zoomLevel); initialValues.put("creationDate",area.creationDate); try { mDb.insertOrThrow("TTArea", null, initialValues); } </code></pre> <p><code>area.longitude</code> is a string whose value is obtained by <code>String.value</code> (A Double Value) Now usually it is something like this <code>22.323434523464563456</code></p> <p>however when i try to retrieve this value </p> <pre><code>public AreaClass getAreaClassWithAreaId(Integer id) { String queryString = "SELECT * FROM TTArea WHERE _id = ?"; Cursor resultSet = mDb.rawQuery(queryString, new String[]{id.toString()}); AreaClass area = new AreaClass(); while(resultSet.moveToNext()) { area = new AreaClass( resultSet.getInt(resultSet.getColumnIndex("_id")), resultSet.getString(resultSet.getColumnIndex("name")), resultSet.getString(resultSet.getColumnIndex("longitude")), resultSet.getString(resultSet.getColumnIndex("latitude")), resultSet.getString(resultSet.getColumnIndex("zoomLevel")), resultSet.getString(resultSet.getColumnIndex("creationDate")) ); } resultSet.close(); return area; } </code></pre> <p>it somehow rounds it to <code>22.3234</code>. In my app i need precise what i am storing. What is this behavior and how can i resolve this?</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