Apart From Intent Is There Any Other Way To Send Data Across Activities In Android Studio
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 statem
Solution 1:
Try something like this
package com.example;
import android.app.Application;
publicclassExampleApplicationextendsApplication {
//Used to pass data between activity components.privateObject universalObject = null;//Can be any type at allpublicvoidsetUniversalObject(Object a) {
this.universalObject = a;
}
publicObjectgetUniversalObject() {
return a;
}
}
You then get the object by calling ((ExampleApplication)getApplication()).getUniversalObject();
Post a Comment for "Apart From Intent Is There Any Other Way To Send Data Across Activities In Android Studio"