I am trying to make a QR Scanner where when the application scans the QR, it will record the code number down to a
public lateinit var result
in the MainActivity.kt class. It works well, I get the result of the scan. Now the thing is, I have created a ListView class where I want to display the list of the currently scanned numbers. My problem is that whenever I try to access the variable, it doesn’t show and gives me an error. I suppose calling it from the class:
MainActivity.result
doesn’t work.
I am told, that it is better to make a fragment and make the list view there and access the listview as it is best to have one main activity class and pull everything there.
Is there a way to make an all accessible variable for all these classes?