parse.com数据库中只添加了一个字段

时间:2014-10-21 19:10:30

标签: android parse-platform

只有在parse.com数据库中保存的最后一个字段,任何人都可以告诉我原因吗? 数据库仅使用地名保存字段" G E"并忽略第一个输入的数据!

    ParseObject testObject = new ParseObject("locations");


    ParseGeoPoint point = new ParseGeoPoint(21.177051,79.061818);

    //1
    testObject.put("placeName", "Brand Factory");
    testObject.put("address","Brand Factory,RKNEC,Nagpur");
    testObject.put("locationPoint", point);
    testObject.put("offers", "10% on Clothing");

    testObject.saveInBackground();
    //2
    point = new ParseGeoPoint(21.177161,79.060533);

    testObject.put("placeName", "G E");
    testObject.put("address","G E, RKNEC, Nagpur");
    testObject.put("locationPoint", point);
    testObject.put("offers", "20% on Shoes");

    testObject.saveInBackground()

1 个答案:

答案 0 :(得分:0)

我认为Parse简单地覆盖你的地方字段。每次使用ParseObject testObject = new ParseObject("locations");之后再添加新值:

//1
ParseObject testObject1 = new ParseObject("locations");
ParseGeoPoint point1 = new ParseGeoPoint(21.177051,79.061818);
testObject1.put("placeName", "Brand Factory");
testObject1.put("address","Brand Factory,RKNEC,Nagpur");
testObject1.put("locationPoint", point1);
testObject1.put("offers", "10% on Clothing");
testObject1.saveInBackground();
//2
ParseObject testObject2 = new ParseObject("locations");
ParseGeoPoint point2 = new ParseGeoPoint(21.177051,79.061818);
testObject2.put("placeName", "G E");
testObject2.put("address","G E, RKNEC, Nagpur");
testObject2.put("locationPoint", point2);
testObject2.put("offers", "20% on Shoes");
testObject2.saveInBackground()