public static void addTourCommit TourCommit commit commits add commit

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
public static void addTourCommit(TourCommit commit) {
commits.add(commit);
if (commit.getVersion() % PERIOD == 0) {
AsyncTask<Void, Void, Void> saveCommitsAsyncTask = new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
for (TourCommit item : commits) {
try {
item.save();
} catch (ParseException e) {
e.printStackTrace();
}
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
commits.clear();
}
};
saveCommitsAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
Log.d("TEST", String.valueOf(commits.size()));
}
}