Reputation: 51
I want to store 3000 rows in a database in my Android App. It is taking so much time. Is there any solution to reduce the time duration?
UPDATE:
public long insertContac1(String country, String city, String category)
{
// TODO Auto-generated method stub ContentValues
initialValues = new ContentValues();
initialValues.put(KEY_COUNTRY, country);
initialValues.put(KEY_CITY, city);
initialValues.put(KEY_CATEGORY, category);
return db.insert(DATABASE_TABLE1, null, initialValues);
}
Upvotes: 0
Views: 270
Reputation: 11775
Try to wrap all in a single transaction:
db.beginTransaction();
try{
// your 3000 insert loop here
db.setTransactionSuccessful();
} finally {
db.endTranscation();
}
Upvotes: 3