Open knight109 opened 2 years ago
The same thing is working on the sample application:
I'd recommend creating a minimal application that can still reproduce the issue - remove the database and firebase logic, as well as any views not directly relevant to this. Then compare it to the sample application and see where it's different to isolate the cause.
I'd recommend creating a minimal application that can still reproduce the issue - remove the database and firebase logic, as well as any views not directly relevant to this. Then compare it to the sample application and see where it's different to isolate the cause.
It still happen with the minimal application. ActivityResultLauncher still not running if i change to other fragment or activity. I use the same code as above and put some Logs, this is my code: https://pastebin.com/ke9BJkmu The Logs result is same as before.
My guess is it's something related to the Activity instead of the Fragment. Are you overriding the onActivityResult
method in the Activity? That can prevent results from being passed on to the Fragment if it's not done correctly.
You're right about the error in the activity.
There was a code about onActivityResult
, i delete it but i still got the error.
So i just do many thing and ended up find what i should do.
switch (item.getItemId()) {
case R.id.nav_event:
fragmentEvent = new FragmentEvent(); //i just need to add this on all case for some reason, the tutorial i use dont do this
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragmentEvent).commit();
return true;
Thanks
Description of the problem:
This app is for Attendance using barcode. I use firebase on this app. The app work as intended, i can scan the barcode and save data to firebase. But the problem is that when i open another Fragment or Activity then back to this Fragment, the scanner dont work as intended. It does open the camera but anything inside ActivityResultLauncher not working. Closing and reopening the app will fix this until i change to other Fragment or Activity again.
Which library version are you using? 4.3.0
Does the same happen on other devices or an emulator? Yes, bot emulator and my device.
Can you reproduce the issue in the sample project included with the library? If not, can you provide your own sample project or sample code that produces this error? This is the code on my fragment: https://pastebin.com/e7XZN08i
In the case of an error do you have a stack trace or adb logs? I made some Logs to check on where the progress at. This the log when working as intended: 2022-02-03 16:01:07.464 20399-20399 I/ContentValues: On Create ..... 2022-02-03 16:01:07.471 20399-20399 I/ContentValues: On Start ..... 2022-02-03 16:01:12.673 20399-20399 I/ContentValues: On Scanner Initialization..... 2022-02-03 16:01:12.683 20399-20399 I/ContentValues: On Pause ..... 2022-02-03 16:01:13.776 20399-20399 I/ContentValues: On Stop ..... 2022-02-03 16:01:17.328 20399-20399 I/ContentValues: On Start ..... 2022-02-03 16:01:17.328 20399-20399 I/ContentValues: On Scanner Launcher..... 2022-02-03 16:01:21.320 20399-20399 I/ContentValues: On Pause ..... 2022-02-03 16:01:21.323 20399-20399 I/ContentValues: On Stop ..... 2022-02-03 16:01:21.376 20399-20399 I/ContentValues: On Destroy .....
This when it not working as intended: 2022-02-03 16:01:26.439 20399-20399 I/ContentValues: On Create ..... 2022-02-03 16:01:26.441 20399-20399 I/ContentValues: On Start ..... 2022-02-03 16:01:27.924 20399-20399 I/ContentValues: On Scanner Initialization..... 2022-02-03 16:01:27.931 20399-20399 I/ContentValues: On Pause ..... 2022-02-03 16:01:28.841 20399-20399 I/ContentValues: On Stop ..... 2022-02-03 16:01:30.567 20399-20399 I/ContentValues: On Start ..... 2022-02-03 16:01:32.785 20399-20399 I/ContentValues: On Pause ..... 2022-02-03 16:01:32.786 20399-20399 I/ContentValues: On Stop ..... 2022-02-03 16:01:32.827 20399-20399 I/ContentValues: On Destroy .....