3
votes

I've updated my eclipse and ADT Plugin from v22.3 to v22.6 recently and recognised some big changes. Whenever I create a new Android Application Project there appears a new appcompat_v7 library which wasn't present on v22.3 plugin and also a fragment_main.xml file which as I understand is meant to replace activity_main.xml file. Why is that? Why is the activity_main.xml file not preferred for activity layout directly anymore and why appcompat library is now included in every project as a necessity?

Is there a way to bring back the old way of creating projects without losing anything? By the way, I create projects compatible with Android versions from 2.2 to 4.4.

1
Google is now trying to enforce better practices of always using a Fragment (even if it's the only one) as opposed to using only Activities. (In my opinion, this is something they should have done a long time ago). - Martin Marconcini
And how about the appcompat library? - Salivan
AppCompat library exists to provide certain newer features (Like the ActionBar) to older versions, in the hopes of create a better and more unified UI/UX to all Android users. You do not need AppCompat if you're going to use API > 14 (unless you use some features that were somehow added to the Support Libraries only. (E.g.: ViewPagers with Fragments may need the support libraries unless you target API 17>) - Martin Marconcini
Well, the best way (or the way I did it) was by reading the Android Docs, then buying a book (that was useless) and then started doing some simple apps (like a useless twitter app that could search twitter and show the results in a list). Having previous iOS Experience, when the BigNerdRanch android book came out, I instantly brought it and it's been a great book that gave me good ideas even tho I was already quite familiar with Android. Practice is your friend. Start developer.android.com/training/index.html and here: developer.android.com/guide/index.html good luck! - Martin Marconcini
Be patient, Android is a big framework, ask questions, make mistakes, try again. Pay attention to detail :) - Martin Marconcini

1 Answers

1
votes

Fragment is useful for navigating through layouts of activity.for example if you have two different layout for portrait and landscape mode then you can simply navigate though the different fragments. Secondly, if you can not even get used to it,just remove the default code from activity_main.xml and and cut the fragment_layout.xml and paste it to activity_main. Then delete the code related to fragment in MainActivity.java.Then delete the fragment_main.xml file. Hope it will work.It worked for me.