Closed ZKjellberg closed 8 years ago
Bullet 4 partially resolves Issue #6.I am not sure yet how to save the state of the Picasso image.
I encountered a few odd issues while testing. (Updated numbers to continue from first post)
if (results == null || results.getResults().size() == 0) {
Does Java check both conditions simultaneously? I cannot reproduce this reliably.FATAL EXCEPTION: main
Process: com.sandro.openalprsample, PID: 26642
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
at com.sandro.openalprsample.MainActivity$2$1.run(MainActivity.java:96)
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)
Regarding my comment bullet 10 on Picasso not embedding images on failures. This was not due to the failure, this was because the variable destination = new File(Environment.getExternalStorageDirectory(), name + ".jpg");
was in the onCreate() and was never updated, resulting in the same file path being used every time, which Picasso did not seem to want to refresh. For the moment, I changed this to a new path on each request. Problem here, which is same problem on exhaustive testing, is the user will create a large collection of images in the data folder which will never be used again.
I am wondering if there is a better approach for this instead of writing to storage. If it is possible to pull directly from camera result and use it in memory for the session. This would remove the need for the storage permission, but would be a challenge for retaining state.
In prior commit I improved TextEdit by setting it the text to be centered.
For latest commit, this should close issue #6. I added a static reference to the last used destination and load this value upon onResume(). Allowing user to rotate screen without losing any data. Curiously my onCreate() TextView initialization value does not overwrite the result.
Think I am happy with current workflow beyond maybe wanting to add a toggle button for EU or USA plates.
- I am sometimes getting a NullPointerException error for the following code: if (results == null || results.getResults().size() == 0) { Does Java check both conditions simultaneously? I cannot reproduce this reliably.
It is necessary to add a null point
check to the results.getResults()
. I will try to do it later.
@ZKjellberg thanks again for your great work! I really appreciate your help.