How to handle slow network connection in Java/Android

前端 未结 3 1344
一个人的身影
一个人的身影 2021-01-06 02:17

I have an app that uses many, many calls to a MySQL database; it does this inside an AsyncTask. Below is a sample of what one may look like.

My main qu

3条回答
  •  情深已故
    2021-01-06 02:29

    1. Your doInBackground returns NULL. return null; You would usually return result; there

    2. your onPostExecute(has NuLL here) :)) as a result. and here onPostExecute(String result) and handle it out this way. Check the example posted again.

    3. You have to handle out these nulls (and perhaps dismiss this progressdialog in the
      onPostExecute() )

    8-13 14:57:00.596: E/AndroidRuntime(2262):     at com.---.--  -.MyFragmentActivity$RateFragment$RatingTask.onPostExecute(MyFragmentActivity.java:461)
       08-13 14:57:00.596: E/AndroidRuntime(2262):     at com.---.---.MyFragmentActivity$RateFragment$RatingTask.onPostExecute(MyFragmentActivity.java:1)
    

提交回复
热议问题