0

I would like to use tabs in my Android application and since TabActivity is deprecated, I want to do it the Fragment way.

I already constructed the skeleton of the app, and I have 3 tabs, and each the tab has its own seperate Fragment.

My questions are:

  1. I ended up having 1 Activity for the whole app and a lot of fragments. Is this normal?
  2. In the fragments I have buttons. Each onClick method of these buttons expect to has its handler in the Activity. I've found this post: Handling onClick events with fragments. Seriously?? The Activity will catch all the onclick's events from all the fragments and call the appropriate method of the relevant fragment?? Can't I handle the onclick event of a button that located inside a fragment in the fragment's code?? If I can't, Google should get some spanks!

Thanks in advance!

Community
  • 1
  • 1
ofirbt
  • 1,846
  • 7
  • 26
  • 41

1 Answers1

0

The answer to question number 2 is to implement onClick in the code of the Fragment... No way of doing this in the XML?

ofirbt
  • 1,846
  • 7
  • 26
  • 41