I have a huge data which i need to insert in sqlite database.
public synchronized void insert(ResponseModel[] response) {
for (int i = 0; i < response.length; i++) { // Here response length is 100
for (int j = 0; j < response[i].getPings().size(); j++) { // Here per response, ping size is around 300
ContentValues cv = new ContentValues();
if (response[i].getPings().get(j).getId() != null)
cv.put(Constants.ID, response[i].getPings().get(j).getId().toString().trim());
// More insertion code goes here
}
}
}
Now in this situation, the application takes too much time. The app doesn't hangs because it happens in a background thread. Is there any way to efficiently handle this huge looping?