Comments (9)
@blunden
Can you upload your sample project code?
I will test and check error.
from tedbottompicker.
I don't have a sample project so I would have to create one. I imagine that this happens in any app using this library though so if you have your own sample app it should be reproducible there too. If not, let me know and I'll have to create one.
You fixed this once before though as described above.
from tedbottompicker.
I faced this issue the other day. I believe it happens when the picker is opened and the underlying Fragment / Activity is destroyed and is trying to recreate the picker.
This may (more than likely) be caused by onSaveInstanceState
not saving the TedBottomPicker.Builder
and thus the NPE being thrown when trying to access showTitle
on builder
after recreating the Fragment.
A solution would be to convert the Builder to a Parcelable
and save it during onSaveInstanceState
and restoring it when needed. The only issue would be that the listeners would not persist - this will require the library to change where listeners do not have to be provided in order to create a picker, instead they can be supplied later on.
A temporary solution is to save an instance of the picker dialog when it is shown and to dismiss()
it during onPause()
.
from tedbottompicker.
@rdadkins If you dismiss onPause, camera intent result will not be handled by picker dialog and you won't get any callback.
from tedbottompicker.
@iammert You're right. I did not test this with the camera, only the initial gallery provided. The gallery intent will also not be handled from what I just discovered. I edited my original response.
from tedbottompicker.
Coming back to this issue, I found a pretty simple solution when using fragments (in Kotlin):
fun showTedBottomPicker() {
val builder = getTedBottomPickerBuilder()
...
val fragment = builder.create()
fragment.show(fragmentManager, TedBottomPicker.TAG) // or any tag you want
}
fun getTedBottomPickerBuilder() = TedBottomPicker.Builder(context) // configure as needed
fun onCreateView(...) {
super.onCreateView(...)
fragmentManager.findFragmentByTag(TedBottomPicker.TAG)?.apply { // match tag above
if (this is TedBottomPicker) {
builder = getTedBottomPickerBuilder()
}
}
}
This will reassign all attributes including the title and click listeners that you define in getTedBottomPickerBuilder()
and should prevent any future NPE's.
There may be better places to utilize findFragmentByTag
- I just found that onCreateView
seems to work fine for me.
from tedbottompicker.
@ParkSangGwon remove this https://github.com/ParkSangGwon/TedBottomPicker/blob/master/app/src/main/AndroidManifest.xml#L12
and this issue is reproduceable everytime you rotate device to landscape .
Dirty fix for me ATM is to set it to Portrait in manifest.
from tedbottompicker.
This issue solved at v1.2.0
from tedbottompicker.
Great! I'll give the new version a try.
from tedbottompicker.
Related Issues (20)
- ProxyActivity Issue.
- On select Google Photos
- Feature enhancement: Select Multiple images
- cant change background colour
- Mime type HOT 1
- 오타 수정 HOT 1
- Images don't load on Android 10+ HOT 9
- Open Camera throws exception on android 10 HOT 1
- Android Manifest Merge error, caused by file provider
- Do Not Have Gallery Option HOT 1
- Fatal Exception: java.lang.RuntimeException HOT 1
- Only shows external storage images
- How to add my own ImageProvider
- Not working for 1+ phones.
- No method explosed to change the span count of grid view
- Android 11 MediaScannerConnection.java line 250 android.media.MediaScannerConnection.lambda$scanFile$2
- picker를 내리거나 뒤로가기 했을때 콜백을 받지 못하나요?
- Could not resolve all files for configuration ':app:debugRuntimeClasspath'. HOT 1
- android 13 WRITE_EXTERNAL_STORAGE 퍼미션 문제
- Could not find gun0912.ted:tedbottompicker:2.0.1.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tedbottompicker.