@Override protected Void doInBackground(Void... params) { if (isCancelled()) return null; // read from OCM: Log.d(TAG, "reading from url=" + url); try { getdata(); } catch (IOException e) { e.printStackTrace(); } Log.d(TAG, "read " + chargePoints.size() + " chargepoints"); // update database: database.beginWrite(); int i; for (i = 0; !isCancelled() && (i < chargePoints.size()); i++) { database.insert_mapdetails(chargePoints.get(i)); } database.endWrite(true); Log.d(TAG, "saved " + i + " chargepoints to database"); return null; }
@Override protected void onPostExecute(Void result) { // TODO Auto-generated method stub super.onPostExecute(result); // main.Diacancel(); name.after(true); database.close(); }