Intent is useful to send data from one activity to another. But I want to send data from 15 components to another activity . How can it be done?? Do I need to write putExtra statement 15 times?
Try something like this
package com.example;
import android.app.Application;
public class ExampleApplication extends Application {
//Used to pass data between activity components.
private Object universalObject = null;//Can be any type at all
public void setUniversalObject(Object a) {
this.universalObject = a;
}
public Object getUniversalObject() {
return a;
}
}
You then get the object by calling ((ExampleApplication)getApplication()).getUniversalObject();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.