saving json data into sqlite

前端 未结 1 1096
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-24 09:20

Hi i need to save json data in sqlite. But iam getting following error.

Can\'t create handler inside thread that has not called Looper.prepare().

1条回答
  •  余生分开走
    2021-01-24 10:01

    This error is due to Toast inside doInBackground(Void... arg0) method:

    Toast.makeText(getBaseContext(),"Data saved",Toast.LENGTH_LONG).show();
    

    Clearly the Android OS wont let threads other than the main thread change UI elements. Follow this link for more details on this: https://dzone.com/articles/android-%E2%80%93-multithreading-ui

    0 讨论(0)
提交回复
热议问题