7

How to pass a parameter to an application that I call from my Application?

Janusz
  • 187,060
  • 113
  • 301
  • 369
army
  • 71
  • 1
  • 2
  • Your problem is solved at this answer http://stackoverflow.com/questions/2923265/android-how-do-i-open-another-app-from-my-app – Bakshish Singh Aug 04 '15 at 14:40

1 Answers1

9

You're starting your other activity with an Intent. It should look similar to this code:

Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
startActivity(intent);

Then you can add a line of code to pass parameters (e.g. Strings):

intent.putExtras("key", "value");

Note: you should add this line before starting the activity ;)

RoflcoptrException
  • 51,941
  • 35
  • 152
  • 200
  • 3
    Note that it's putExtra not putExtras. putExtras has another signature. – Alexandru Badiu Nov 08 '11 at 15:04
  • Why this answer has got so many upvotes? The question was about calling another Application, so you cannot use 'SecondActivity.class' that is in the code of the second application. – ARLabs Jun 28 '21 at 10:19