Parcelable plugins in Android are used

Source: Internet
Author: User
Tags object serialization

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.