Reputation: 23
On updating ADT a fragment_main.xml is created apart from activity_main.xml,what is the neccessity of fragment_main.xml ? Is it neccesary to write the code in both xml?
Upvotes: 2
Views: 110
Reputation: 1942
Not completely necessary, in the last update Google decided that the programmers need use more the Fragments
http://www.vogella.com/tutorials/AndroidFragments/article.html
http://www.tutorialspoint.com/android/android_fragments.htm
This is because in this moment exists multiple devices with differents resolutions an screen sizes, and programing using just activitys is not a best practices, actually the fragments is the best way to programming for multiple devices.
Upvotes: 0
Reputation: 13223
Since most people are using Fragments
these days, the new ADT update provides templates to avoid having to write all that code yourself. fragment_main.xml
is the layout file that corresponds to the Fragment
created by the template. You can avoid creating the Fragment
if you click on Blank Activity
on the new project wizard when creating the project.
Upvotes: 1