2

I am trying to send a set of data from one Activity under project A , package a , into another Activity under project B , package b for Android project integration.

How to modify the Intent myintent = new Intent () in order can such be achieved?

The below is my part of code of project A, package a ..

try {
    Intent myIntent = new Intent();
    Bundle myData = new Bundle();
    myData.putInt("cntKey", contractKey);
    myData.putInt("workTypeKey", workType);
    myData.putInt("estateIDKey", estateID);
    myData.putInt("workIDKey", workID);
    myData.putInt("blockIDKey", blockID);
    myData.putInt("districtIDKey", districtID);
    myData.putString("estateRoomNumKey", estateRoomNumber);
    myData.putString("estateKey", estate);
    myData.putString("blockKey", block);
    myIntent.putExtras(myData);
    startActivityForResult(myIntent,0);
} catch (Exception e) {
    Toast.makeText(getBaseContext(), e.getMessage(), Toast.LENGTH_LONG).show();
}

Now I am trying to pass some data from one Activity , package a , project A into another Activity, package b , Project B

The Project A itself is a library project.

What should I begin with if using Indents and Bundle?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Jeff Bootsholz
  • 2,971
  • 15
  • 70
  • 141

2 Answers2

1

I think what you need to use is a broadcast.

Robert
  • 8,717
  • 2
  • 27
  • 34
StealthOne
  • 194
  • 9
1

If you can modify project B also, I would just go with

myIntent = new Intent("some.very.unique.id.that.you.define")

and then declare an intent filter for that id in the Android manifest of activity B in package B.

Other activities of third party party apps could also register the same intent filter, so don't use this solution if you want to transfer sensitive data. In such a case, the full solution would probably be AIDL.

Bananeweizen
  • 21,797
  • 8
  • 68
  • 88