[Switch] Android Parcelable and Serializable, androidparcelable
This article mainly introduces the functions, efficiency, difference and selection of Parcelable and Serializable. For details about Serializable, see the advanced understanding of Java serialization.
1. Role
Serializable is used to save the attributes of an object to a local file, database, network
more efficient than standard Java serialization, it is also used to exchange data in aidl. Therefore, the display serialization technology like parcelable can greatly improve the data exchange performance.
Serializable
The traditional Java and serializable technology implement the serializable interface. The principle is similar to that of parceble. They all c
By default, Aidl supports java basic types (int, long, boolean, etc.) and (String, List, Map, CharSequence ), how can I implement a custom type? To pass a custom type, first make the custom type support the parcelable protocol. The implementation steps are as follows: 1> the Parcelable interface must be implemented for the custom type, and implements the public v
This paper mainly introduces the function, efficiency, difference and choice of parcelable and Serializable, and introduces the advanced knowledge of Java serialization in the introduction of serializable.1. functionSerializable's role is to save the object's properties to local files, databases, network streams, RMI for easy data transfer, which can be within a program or between two programs. The Android
This paper mainly introduces the function, efficiency, difference and choice of parcelable and Serializable, and introduces the advanced knowledge of Java serialization in the introduction of serializable.2. UseSerializable's role is to save the object's properties to local files, databases, network streams, RMI for easy data transfer, which can be within a program or between two programs. The Android
The serializable and Parcelable interfaces can accomplish the serialization of objects, and we need two serialization methods when we need to transfer data through intent and binder. Also, we need objects to be persisted to the storage device or transmitted over the network to other clients, and this use also requires the use of Serializale to complete the serialization of the object. Both of these approaches are common in Android app development, but
This paper mainly introduces the function, efficiency, difference and choice of parcelable and Serializable, and introduces the advanced knowledge of Java serialization in the introduction of serializable.2. UseSerializable's role is to save the object's properties to local files, databases, network streams, RMI for easy data transfer, which can be within a program or between two programs. The Android
For Android, passing complex types is primarily about converting its own class into a base byte array, and passing data between the activity is accomplished through intent. There are two main methods of the Android serialization object, which is to implement the serializable interface, or implement the Parcelable interface. The implementation of the serializable interface is supported by the Java SE itself,
interface content, but its extension is. aidl. Save it in the src directory. If other applications require IPC, the SRC of those applications will also carry this file. Android SDK tools automatically generates an ibinder interface file in the gen directory. Service must implement this ibinder interface as appropriate. Then the client program can bind the service and call the method from ibinder during IPC. Each aidl file can only define one interface, and can only be an interface declaration a
Greendao The storage of object data can be implemented with parcelable. 1. Greendao Greendao is an ORM solution that can help Android developers quickly map Java objects to a form in a SQLite database, and by using a simple object-oriented API, developers can store, update, delete, and query Java objects. 2. parcelable
PersonSerializable(); ps.setAge(27); ps.setName("wangzhengyi"); ps.setSex("boy"); ps.setSkills(new ArrayList
Receive the PersonSerializable object in activity-2:
Intent intent = getIntent();PersonSerializable ps = (PersonSerializable)intent.getSerializableExtra("person");Log.e("wangzhengyi", "person name :" + ps.getName());Log.e("wangzhengyi", "persion age :" + ps.getAge());
Parcelable
The following steps are required to
storage medium and then read it?Because of the explanation in the second, there is a need to acquire the specified Java object in the case of a JVM that is not running, or on other machine JVMs.Iv. What is the difference between serializable and parcelable in Android?Both are used to support serialization, deserialization, the biggest difference between the storage medium is different, serializable use IO
Add a Parcelable serialization tool to Android Studio (rapidly improving development efficiency)Add a Parcelable serialization tool to Android Studio (rapidly improving development efficiency)
Android Studio is a development tool provided by google for Android development. You can directly add some useful development tools in it. here we will explain how to add these tools, we recommend a very useful object
How to Use Parcelable in android Development
To transfer objects between two activities, the object must be serialized. There are two methods to serialize an object in android, one is to implement the Serializable interface, which is very simple, just declare it. However, there is a special serialization method in android, that is, implementing the Parcelable interface. The serialization efficiency of this
Android serialization object interface Parcelable usage method, androidparcelable
What is Parcelable?
Parcelable defines the interfaces for writing data to Parcel and reading data from Parcel. An object (represented by a class). To encapsulate it in a message, you must implement this interface to implement this interface, this entity becomes "packable.
Experience is constantly accumulating small knowledge.
Parcelable is not recommended, but serialization is not recommended to transmit data between activities.Why is Android not using the built-in Java serialization mechanism? It turns out that the android team came to the conclusion that the serialization in Java is far too slow to satisfy Android's interproces
Android Studio Add parcelable serialization gadget (quickly improve development efficiency) Android Studio is a development tool that Google has developed specifically for Android, where you can directly add some very useful development gadgets, explaining how to add these gadgets And to recommend a very useful object when passing, the object must be serialized to the interface parcelable gadget;Here we i
Hello everyone, I haven't seen you for a long time. Today I want to tell you how to pass objects in intent in Android. As far as I know, there are two methods: bundle. putserializable (Key, object); bundle. putparcelable (Key, object); of course, these objects have certain conditions. The former implements the serializable interface, and the latter implements the parcelable interface, to make it easier for everyone to understand, I wrote a simple demo
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.