here is my jsonString:
{
"status":1,
"data":[
{
"id":"39",
"friendsInfo":{
"email":"test@gmail.com",
"phone":null,
"language":"en"
}
},
{
"id":"39",
"friendsInfo":{
"email":"test@gmail.com",
"phone":null,
"language":"en"
}
}
],
"message":""
}
here is my receivingClass:
public class mAnswer{
@SerializedName("status")
public int mEnterStatus;
@SerializedName("data")
public List<Data> dataList;
public class Data {
@SerializedName("id")
public int mUserId;
@SerializedName("friendsInfo")
public GetUserDetails getUserDetails;
public class GetUserDetails{
@SerializedName("email")
public int email;
@SerializedName("phone")
public String phone;
@SerializedName("language")
public String language;
}
}
}
and here is my code for successful receiving answer where I am trying to save this data to SQLite db:
private void saveList(){
Vector<ContentValues> cVVector = new Vector<ContentValues>();
int arraySize = mAnswer.dataList.size();
for (int i = 0; i < arraySize; i++){
// **HERE IS PROBLEM**
cVVector.add(friendsValue);
}
if (arraySize > 0 ){
ContentValues[] cvArray = new ContentValues[arraySize];
cVVector.toArray(cvArray);
mContext.getContentResolver().
bulkInsert(J4D_DB_Contract.UserFriendsEntry.CONTENT_URI, cvArray);
}
}
So here is my problem: how to correct call @SerializedName elements when i am trying to save List data to db?
any ideas? Will be glad any help! Thanks!
Aucun commentaire:
Enregistrer un commentaire