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:
- I ended up having 1 Activity for the whole app and a lot of fragments. Is this normal?
- 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?? TheActivity
will catch all the onclick's events from all the fragments and call the appropriate method of the relevant fragment?? Can't I handle theonclick
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!