Hi, We're seeing some very odd behaviour regarding ContentValues. It appears that the key value pairs are being overwritten. We are seeing the right mod count but not all the values are written in.
Any ideas would be much appreciated, the code in question is below. int length = newsItems.length(); for (int i = 0; i < length; i++) { ContentValues cv = new ContentValues(20); // TODO find out what the problem is with the content value class overwriting (serious wtf) JSONObject newsItem = newsItems.getJSONObject(i); JSONArray contentItems = newsItem.getJSONArray("contentitem"); // TODO Use constants in SkyNewsDatabaseOpenHelper cv.put("_newsitemid", newsItem.getString("newsitemid")); cv.put("firstcreated", newsItem.getString("firstcreated")); cv.put("thisrevisioncreated", newsItem.getString ("thisrevisioncreated")); cv.put("headline", newsItem.getString("headline")); cv.put("byline", newsItem.getString("byline")); cv.put("slugline", newsItem.getString("slugline")); cv.put("breakingnews", newsItem.getString("breakingnews")); cv.put("datacontent", newsItem.getString("datacontent")); // TODO Inefficient? // TODO Remove magic numbers cv.put("imageurl", contentItems.getJSONObject(0).getString ("href")); cv.put("thumbnailurl", contentItems.getJSONObject(1).getString ("href")); // TODO Make this less brittle if(contentItems.length() > 2) { // Has a video cv.put("videourl", contentItems.getJSONObject(2).getString ("href")); cv.put("video", "true"); } else { // TODO Change database structure t default cideo field to false so thsis code doesn't have to be executed. cv.put("video", "false"); } db.insert (SkyNewsDatabaseOpenHelper.TABLE_NAME_NEWS,SkyNewsDatabaseOpenHelper.COLUMN_NAME_TITLE,cv); } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---