I have two application , com.appone.one
and com.apptwo.two
.
I want transfer data from appone
to apptwo
,I want when a data transferred to apptwo
, apptwo
opens or if open only come up(onResume) and show that data.
I wrote this code:
com.appone.one:
Intent i = new Intent(Intent.ACTION_DATE_CHANGED);
PackageManager manager = getPackageManager();
i = manager.getLaunchIntentForPackage("com.apptwo.two");
i.putExtra("MessageText",""+Connect.MessageArrive.toString());
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
com.apptwo.two:
@Override
public void onResume() {
super.onResume();
String name=getIntent().getStringExtra("MessageText");
Toast.makeText(getApplicationContext(),String.valueOf(name), Toast.LENGTH_LONG).show();
}
I want only write this line :
String name=getIntent().getStringExtra("MessageText");
in OnResume
because I don't want apptwpo load again,If I write this line in onCreate
, my code works fine. but I want that in onResume
.
Now apptwo
returns null :(
what should I do? thanks in advance