In this paper, an example is given to analyze the method of intent passing objects in Android development. Share to everyone for your reference, specific as follows:
Method One:
Use method: Public Intent Putextra (String name, parcelable value) passes a parceable parameter that is serialized to memory.
Use method: Public Intent Putextra (String name, Serializable value) passes an object that implements the serialized interface class, and the argument of this method is serialized to disk.
Method Two:
Store the data in the "context" of the application, define the MyApplication class, let it inherit the application class, and deposit references to the relevant data in MyApplication. The code is as follows:
Import android.app.Application;
Import Cn.itcast.mobilesafe.domain.TaskInfo;
public class MyApplication extends application {public
taskinfo tastinfo;
}
To configure application in the manifest file:
<application
android:icon= "@drawable/ic_launcher"
android:label= "@string/app_name" Android:name= " MyApplication ">
<uses-library android:name=" Android.test.runner "/>
The data to be stored is stored in application:
Intent Intent = new Intent (taskmanageractivity.this, appdetailactivity.class);
MyApplication myApp = (myapplication) getapplication ();
Object obj = lv_task_manager.getitematposition (position);
if (obj instanceof taskinfo) {
TaskInfo info = (taskinfo) obj;
Myapp.tastinfo = info;
StartActivity (intent);
}
More interested readers of Android-related content can view this site: "Introduction to Android Development and advanced Course", "Android Communication Summary", "Android Basic Components Usage Summary", "Android View Summary", " Android Layout layout Tips and a summary of the use of Android controls
I hope this article will help you with the Android program.