Received from the json server in which 18 thousand records are stored. When the onResponse method is executed, the application hangs. I use orm sugar , retrofit

 @Override public void onResponse(Response<List<ModelJoke>> response, Retrofit retrofit) { List < ModelJoke > list=response.body(); for (ModelJoke ob:list) { jokes=new dbJokes(ob.id,ob.cid,ob.value); jokes.save(); } mProgressDialog.dismiss(); } 

After recording is complete, the application is working again What could be the problem?

  • 2
    You write to the database in the main thread - temq
  • one
    The method is executed in the main thread. take out his minor - Vladyslav Matviienko

0