java.lang.RuntimeException: An error occured while executing doInBackground()

后端 未结 4 631
[愿得一人]
[愿得一人] 2020-12-03 21:27

Sometimes i get this crash error in my app

java.lang.RuntimeException: An error occured while executing doInBackground()

This is the full l

4条回答
  •  悲&欢浪女
    2020-12-03 22:19

    I think In this code Toast make problem for you,

    catch (Throwable t){
                  Log.e("OSFP.News",t.getMessage(),t);
    
                    Toast.makeText(nea.this, "Χρειάζεστε σύνδεση στο internet",
                            Toast.LENGTH_SHORT).show();
                    finish();
    
                }
    

    Because you are trying to do UI operation from worker thread of AsyncTask this will never allowed..

    UPDATE: If you want to update something from the doInBackGround() of AsyncTask use publishProgress(Progress...) and onProgressUpdate(Progress...).

提交回复
热议问题