regulaforensics / DocumentReader-Android

Android Framework for reading and validation of identification documents
64 stars 26 forks source link

Navigate to another fragment from Completion COMPLETE #36

Closed jonneymendoza closed 3 years ago

jonneymendoza commented 3 years ago

Hi. i am trying to navigate to another fragment using android's navigation API via `findNavController().navigate but it seems as though i am unable to do so as it produces this error below and never goes to the next fragment screen.

error:

E/Parser: Missed LEX value

THe completion block of code

IDocumentReaderCompletion { action, results, error ->
            // processing is finished, all results are ready
            if (action == DocReaderAction.COMPLETE) {
                  val documentNumber = results.getTextFieldValueByType(eVisualFieldType.FT_DOCUMENT_NUMBER)
                Timber.d("JJJ doc reader completed with results ${documentNumber}")
                   findNavController().navigate(MyFragmentDirections.actionNavigationResultsFragment(documentNumber))
            } else {
                // something happened before all results were ready
                if (action == DocReaderAction.CANCEL) {
                    Timber.d("CANCEL")
                } else if (action == DocReaderAction.ERROR) {
                    Timber.d(" error")

                }
            }
        }

I notice that in the sample app you do something similar where you get the results, do some logic and then progress to a results screen. the only difference is that i see that you are using activities to navigate to the result screen and not fragments

Is there a way to navigate to a new fragment? we use one activity for our whole app and use navigation fragments for each screen.

dsshreya commented 2 years ago

@jonneymendoza May I know how you have fixed this issue ? I've come across the same.