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().
>
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