SandroMachado / openalpr-android

Android Automatic License Plate Recognition library (http://www.openalpr.com) ported for android.
Apache License 2.0
770 stars 272 forks source link

[Sample Application] State Lost on Rotation #6

Closed ZKjellberg closed 8 years ago

ZKjellberg commented 8 years ago

If the user rotates the screen, the image & result will be lost. I suggest retaining the state of at least the TextView result.

If the user rotates the screen while the request is being processed, it will result in a NullPointerException crash. This is similar to #5 except this may actually still have valid data as it is delayed until the processing finishes.

Process: com.sandro.openalprsample, PID: 4146
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.ArrayList org.openalpr.model.Results.getResults()' on a null object reference
  at com.sandro.openalprsample.MainActivity$2$1.run(MainActivity.java:104)
  at android.os.Handler.handleCallback(Handler.java:739)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:148)
  at android.app.ActivityThread.main(ActivityThread.java:5417)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
SandroMachado commented 8 years ago

Closed by #7.