I created a library, and its library has 4 activity. I move between theese activitys with intent, but i dont know how could i send result data, to the main application? I start my library like this:
Intent intent = new Intent(this, LibraryFirstActivity.class);
startActivityForResult(intent, 1);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1){
if (resultCode == RESULT_OK){
String result = data.getStringExtra("result");
Log.d("result", result);
}
if (resultCode == RESULT_CANCELED){
Toast.makeText(this, "CANCELED", Toast.LENGTH_SHORT).show();
}
}
}
I start LibraryFirstActvity. In LibraryFirstActivity i go to the LibrarySecondActivity:
Intent intent = new Intent(this, LibrarySecondActivity.class);
startActivity(intent);
finish();
But i can go to the LibraryThirdActivity too, or other.
So how can i return to the main app onActivityResult()
method?