0

Possible Duplicate:
ViewPager Activity to notify a Fragment of a specific event

I am experimenting with using fragments and I ran into this problem. I have a service running in the background which I want to update a listview in a fragment. First I just wanted to have the fragment listen for a broadcast, but it seems like registerReceiver is not allowed in a fragment? How do I do this. Do I need to listen for a broadcast in the main activity and then somhow send it to the fragment?

Community
  • 1
  • 1
Jim
  • 995
  • 2
  • 11
  • 28

1 Answers1

2

I'd use the activity for this. Google has some good examples and description of the topic fragment and activity communication. You can read about it here: http://developer.android.com/training/basics/fragments/communicating.html

In short, fragments use listeners to communicate with activities and activities just use public methodes in fragments.

Warpzit
  • 27,966
  • 19
  • 103
  • 155