I'm new with android apps development (but have some Java experience) and I am struggling a little bit with how I should design my app. For example:
When I execute the App I have a start page with the logo and two buttons: Register and LogIn. This should be the first activity.
1.) If I press the register button I see a page (another activity) with the input fields, a register button but also a Facebook and a Google+ Button.
2.) If I press the login button I see a page (another activity) with the input fields, a login button but also a Facebook and Google+ button.
Instead of implementing the facebook and google+ button twice, I thought about putting the google+ button and its functions into a seperate fragment and the same for the facebook button so I can reuse them.
Is this a "good" interpreatation of activities and fragments and if not when should I use fragments and activities? I thought about fragments like reuseable containers which can be implemented in different activities.
Thanks for any advice!
Activities, fragments and views have very similiar purpose, but on different levels. You can freely mix them as you wish as long as it's working for you. Personally I don't like fragments, so I'm only using activities and views in my apps. Here are the main differences:
And similarities:
Basically activity consists of a window and a layout (and some data & logic). Fragment consists of a layout (and some data & logic). View is a layout or a widget (and some data & logic).
Answering your question - This means that your approach is fine. At least for me. If you plan to reuse these buttons only as a UI components, you can rewrite them as views.