Method analysis of intent passing object in Android Development

This paper analyzes the method of intent passing objects in Android development. Share with you for your reference, as follows:

Method 1:

Use the method: public intent putextra (string name, Parcelable value) to pass a Parcelable parameter, and the parameters of this method are serialized to memory.

Use the method: public intent putextra (string name, serializable value) to pass an object that implements the serialization interface class, and the arguments of this method are serialized to the disk.

Method 2:

Store the data in the "context" of the application, define the myapplication class, let it inherit the application class, and store the reference of relevant data in myapplication. The code is as follows:

Configure the application in the manifest file:

Save the data to be stored in the application:

More readers interested in Android related content can view the special topics of this site: introduction and advanced tutorial of Android development, summary of Android communication mode, summary of Android basic component usage, summary of Android view skills, summary of Android layout technology and summary of Android control usage

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>