Skip to content

Instantly share code, notes, and snippets.

@hkusoft
Last active July 13, 2016 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkusoft/4a42aa4fdb4bfc8130e5535fc882ebee to your computer and use it in GitHub Desktop.
Save hkusoft/4a42aa4fdb4bfc8130e5535fc882ebee to your computer and use it in GitHub Desktop.
final String key1 = "EMAIL";
final String key2 = "ACCESS_TOKEN";
mSomeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = getPackageManager().getLaunchIntentForPackage("com.abc.secondapp");
if(intent != null) {
Bundle extras = new Bundle();
extras.putString(key1, "SomeEmail@gmail.com");
extras.putString(key2, "ldkjgkjgioerjijbmgjQ2349487598");
intent.putExtras(extras);
startActivity(intent);
}
}
});
//2nd app, whose package name = "com.abc.secondapp"
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_abcdef);
String info = "Received Information";
if (getIntent().hasExtra(key1))
info = key1 + ":" + getIntent().getStringExtra(key1);
if (getIntent().hasExtra(key2))
info = info + "\n" + key2 + ":" + getIntent().getStringExtra(key2);
TextView resultView = (TextView) findViewById(R.id.received_info);
if (resultView != null)
resultView.setText(info);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment