Modularidad de la aplicación al usar fragmentos de Android

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

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

Mis preguntas son las siguientes:

  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!

Gracias de antemano!

preguntado el 02 de febrero de 12 a las 10:02

1 Respuestas

The answer to question number 2 is to implement onClick en el código de la Fragment... No way of doing this in the XML?

Respondido 02 Feb 12, 16:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.