How do you add an Enum object to an Android Bundle?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
One thing to be aware of -- if you are using
bundle.putSerializable
for aBundle
to be added to a notification, you could run into the following issue:To get around this, you can do the following:
Which can then be used like so:
Use bundle.putSerializable(String key, Serializable s) and bundle.getSerializable(String key):
Documentation: http://developer.android.com/reference/android/os/Bundle.html
I use kotlin.
then put into Intent:
when you net to get value:
For Intent you can use this way:
Intent : kotlin
FirstActivity :
SecondActivity:
Another option:
For completeness sake, this is a full example of how to put in and get back an enum from a bundle.
Given the following enum:
You can put the enum into a bundle:
And get the enum back: