-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UninitializedPropertyAccessException caused by accessing imageAdapter #254
base: develop
Are you sure you want to change the base?
Conversation
…h due to UninitializedPropertyAccessException
c2c1657
to
86fedd5
Compare
Thanks for the PR. And sorry for replying so late. |
- add finishActivity in AlubumContract to finish AlbumActivity with passed code
Yes, we do not open Activity in case of ImageAdapter is null. I recorded the video for a demonstration by simply passing null. When pick up image:sample.mp4When open album view:sample3.mp4 |
@sangcomz |
@KoheiMoroi
There is an error log in the issue, I will check that part. |
@KoheiMoroi It would be nice to inform the error situation through toast or message dialog. And I wish that message could be customized too. Could you work on this part too? |
It would be informative if we could have the error message. |
Here is error log(from beginning to the crash): ---------------------------- PROCESS STARTED (29638) for package com.sangcomz.fishbundemo ---------------------------- |
7b8909a
to
ac5fe0e
Compare
@sangcomz |
- display the dialog when error happens while processing image - change nullable signature of constructor of the adapter - add japanese resources
ac5fe0e
to
a8d49bc
Compare
@KoheiMoroi I've been thinking about it additionally, how about changing to using toast instead of dialog? Because dialog is likely to use a different ui than the app that uses the library. On the other hand, toast seems unlikely, so it would be better to inform them with toast. And, in the case of a dialog, the user has to close the dialog for further interaction, but I don't think this is necessary. Please check once. Thank you for adding Japanese. 🇯🇵 |
The dialog certainly differs from the app's design theme, they don't want it. |
ddea2f4
to
b77dfa4
Compare
@sangcomz Here is the crash log:
|
@KoheiMoroi thanks for the good clue. |
And sorry for the late response.🙏 |
It's my pleasure. |
@KoheiMoroi I'm trying to reproduce it now, but does it happen when I simply add implementation "androidx.fragment:fragment-ktx:1.5.5" to the fishbundemo project? I seem to be working fine, are there other conditions? |
My bad.
|
@KoheiMoroi Thanks, I found the problem code. in DetailImageActivity.kt
|
Please test once through this version. |
Got it. |
oh, you need to add the code below to get a snapshot.
I will upload it as version 1.1.1. |
@KoheiMoroi I'll close this PR. 🙇 |
@sangcomz |
Fixes issues #234 #253.
Unfortunately, I could not reproduce the exception that those issues say.
However, there are a few scenarios in which the app crashes.
If the system destroys the activity due to system constraints such as configuration change or memory pressure, you can not access objects which are reclaimed by the System.
Ideally, View objects should belong to call-site's(Such as Activity) lifecycle, but I don't want to apply big changes, so added null-check implementation(in that case we finish the Activity) to avoid the crashes.
This PR changes:
ImageAdapter
Link
Activity state and ejection from memory
Screenshot
Demonstration in the case of null
sample.mp4