jroal / a2dpvolume

Automatically exported from code.google.com/p/a2dpvolume
http://jimroal.com/slist.htm
95 stars 33 forks source link

Crash caused by rotating the screen on the "manage data" page #295

Open sjl872964789 opened 4 years ago

sjl872964789 commented 4 years ago

Describe the bug Crash caused by rotating the screen on the "manage data" page

To Reproduce Steps to reproduce the behavior:

  1. Install a2dp and open app
  2. Click three points in the upper right corner
  3. Click "manage data"
  4. Click "import database from sd card
  5. Rotate screen
  6. Back
  7. Crash

Expected behavior Not crash

Smartphone (please complete the following information):

Additional context logcat:

: java.lang.RuntimeException: An error occurred while executing doInBackground()
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at android.os.AsyncTask$4.done(AsyncTask.java:399)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at java.util.concurrent.FutureTask.run(FutureTask.java:271)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:919)
08-08 05:19:06.505  7795  8103 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at android.widget.Toast.<init>(Toast.java:121)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at android.widget.Toast.makeText(Toast.java:286)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at android.widget.Toast.makeText(Toast.java:276)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at a2dp.Vol.DeviceDB.selectAll(DeviceDB.java:247)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at a2dp.Vol.ManageData$SelectDataTask.doInBackground(ManageData.java:398)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at a2dp.Vol.ManageData$SelectDataTask.doInBackground(ManageData.java:385)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at android.os.AsyncTask$3.call(AsyncTask.java:378)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
08-08 05:19:06.505  7795  8103 E AndroidRuntime:    ... 4 more

record: ezgif com-video-to-gif (3)

jroal commented 4 years ago

Like all the other issues around screen rotation, I consider them all very low priority. This app is a utility that you set up once and forget. The user does not spend much time in the UI. I am just an amateur developer and as you can see, UI development is not my thing. If someone want to figure out what I need to change and provide the fix here, fine I will integrate it. I do not plan to spend any time working on screen rotation issues though.

uschindler commented 4 years ago

I would just disable screen rotation on the activity config. Problem solved. 👍🏻

jroal commented 4 years ago

I would just disable screen rotation on the activity config. Problem solved. 👍🏻

Perfect! That is now my plan for all the rotation issues. I will simply block all rotations as they are not needed for this app anyway. Everything will now be forced portrait.

sjl872964789 commented 4 years ago

Thanks for your quick fix, at least now a2dp will not crash frequently due to accidental rotation, cheers!