@Override protected void onPreExecute() { super.onPreExecute(); try { db.open(); } catch (SQLException e) { e.printStackTrace(); } }
@Override protected Boolean doInBackground(Void... params) { jParser = new JSONParser(); jsoni = jParser.getJSONFromUrl(fetch_json); JSONObject rates = null; db.DeleteFromTable("currency_offline_table"); try { rates = jsoni.getJSONObject("rates"); l = rates.length(); for (int i = 0; i < rates.length(); i++) { db.CreateEntry(list.get(i), rates.getString(list.get(i))); } } catch (JSONException e) { e.printStackTrace(); } return null; }
@Override protected void onPostExecute(Boolean aBoolean) { super.onPostExecute(aBoolean); db.close(); nmain.startNewMainActivity(); }