0

I am using intent to transfer data.

When I try the following code,

Intent intent=getIntent() or Intent intent=getIntent(DrawerActivity.this, null)

Exception will occur.

How can I use intent to put data but do not jump to another activity?

felix12340
  • 77
  • 1
  • 5

3 Answers3

1

If you want to put data somewhere on the app and not use it instantly, then You can store some values on SharedPreferences, especially if it's not huge amount of data

Patroy
  • 367
  • 5
  • 19
0

Intent is a mechanism to pass data from one activity to another. If you have to store some data in a place and then later send it to another activity, create a bundle, store data in it and then when you have to go to next activity then create a intent, set the class of the next activity and in putExtras pass the bundle and the data will be sent to that activity.

Harshith Shetty
  • 351
  • 4
  • 10
0

It is depends of situation, you can use PendingIntent or you can create Bundle and put in it what values you want and when you want to start the activity then pass the Bundle as desctibed here.

DimDim
  • 371
  • 1
  • 18