Last active
July 13, 2016 09:58
-
-
Save hkusoft/4a42aa4fdb4bfc8130e5535fc882ebee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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