1

A Bundle can save many types of data: short, byte, another Bundle, ArrayList<Integer>, yet not a simple long.

How can this best be achieved? Must it be converted to a ArrayList<Integer>?

serv-inc
  • 35,772
  • 9
  • 166
  • 188

2 Answers2

6

Are you sure? There are putLong() in docs.

Ilya Tretyakov
  • 6,848
  • 3
  • 28
  • 45
  • 5
    Note that it's declared on `BaseBundle`, and so will show up in the inherited methods when looking at `Bundle`. – CommonsWare Sep 28 '15 at 16:20
1

You can store a long inside a bundle^^

Here is how to store your value

//store the long value
long myNumber = 123456789;
Bundle bundle = new Bundle();
bundle.putLong("MY_KEY", myNumber);

//then start your activity

Here is how to retrieve

//retrieve the long value
long value = bundle.getLong("MY_KEY");
Kassisdion
  • 345
  • 3
  • 13