0

I have 3 classes:

  • AddText(extends Activity)
  • Grafitti(extends MapActivity)
  • MarkerOverlay

Grafitti calls AddText, and AddText opens a new Activity that gets an input from user (EditText), then when that is successful Grafitti calls MarkerOverlay.

The problem is I can't access the input in AddText. I need to use that input in MarkerOverlay, I tried creating a setter and getter but it won't work. (error)

I've tried searching the web and I think the solution is Bundle. I'm having a hard time understanding how Bundle works. Is there any other way? or any code snippet on how to use Bundle. A code snippet would really help me a lot.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
lulala
  • 637
  • 4
  • 12
  • 21

2 Answers2

1

Look into startActivityForResult(Intent intent, int requestCode).

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jeff Barger
  • 1,241
  • 1
  • 13
  • 19
1

Grafitti needs to start AddText via startActivityForResult() and then listen for the result via onActivityResult().

For more info see this: https://developer.android.com/reference/android/app/Activity.html#StartingActivities

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Mark B
  • 183,023
  • 24
  • 297
  • 295