Skip to content Skip to sidebar Skip to footer

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;

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();


Post a Comment for "Apart From Intent Is There Any Other Way To Send Data Across Activities In Android Studio"