In the process of Android development, it is recommended to use parcelable instead of seralizable for object serialization because the parceable is relatively efficient.
In this way, for a large number of objects in Android, handwriting implementation of the cost of parcelable, it is relatively high. The landlord on GitHub found a parcelable for Intelij and Androidstudio plug-ins, just integration, and then direct shortcut keys to achieve parcelable interface, so not very cool?
1. Parcelable Plugin Address: Https://github.com/mcharmas/android-parcelable-intellij-plugin
2.: https://github.com/mcharmas/android-parcelable-intellij-plugin/releases/tag/0.6.1
3. Follow the documentation to import the corresponding plug-in jar package in the IDE's plugins, and then reboot and integrate.
4. Shortcut key problem, landlord in the integration, found that the corresponding document said ALT + Insert does not work, so you need to reset it. Into the IDE keymaps, Search parcelable, set shortcut keys, landlord set ctrl+cmd+p. In the corresponding model class, hit the shortcut key, everything OK.
PS: The landlord found this plug-in, the data for the list, support is not very perfect, there are two problems:
1) list<string> type of data: When using parcelable to read data, you can directly call parcel readstringlist (params) to read, wherein the params, refers to you need to specify a new, After initializing the list<string> data,
2) list<object> type of data: Object refers to your custom data, you can first implement the Parcelable interface to Object, so it will be for this generation Readtypedlist method, but when you use this method, The list data needs to be initialized, as follows:
if NULL ) new arraylist<poivo>(); In.readtypedlist (nodes, poivo.creator);
3) list<list<object>> type of data: Use the following code to:
This New Arraylist<list<poivo>>(); In.readlist (thisnull);
Parcelable plugins in Android are used