3

After updating my DDMS i realized that whenever i want to create a new project, a support library called appcompatv7 is being added to my project window automatically.

And this library adds some feauters which i never used before. I just want to create a simple android project with one Blank Activity and one activity_main.xml. But this library also adds an xml file named activity_fragment.xml

So how can i create a simple project without using this support library? If somebody make things clear i will appreciated.

mrgenco
  • 348
  • 2
  • 9
  • 27

1 Answers1

6

The AppCompat library is added when you set your min target to something under API level 13 or 14. (HoneyComb or Ice Cream Sandwich) so those apps can use and have an ActionBar (among other things). The support library (v4) on the other hand is required for ViewPagers in anything below API Level 16 (the FragmentAdapters of a ViewPager use Fragments from the Support Library in API level 14 and 15). It's only in Support V13 that the ViewPager Adapters start using the new "pure" Fragments.

So if you want a "pure/non support" Android App, you can go for API level 14, but you might still need the Support V4 library for some things.

For unknown reasons (I'm sure they had some), Google added some stuff directly into the compatibility library (and viceversa) only so sometimes you need it even when you really don't want all the code…

Martin Marconcini
  • 26,875
  • 19
  • 106
  • 144
  • Thanks for this clear explanation sir. But is this framelayout and fragment_main.xml is something comes with DDMS update? When i create a project with API level 14 there is no support library like you said but still there is this fragment_main.xml with activity_main.xml. Is this something that i cant change anymore? – mrgenco Mar 16 '14 at 16:42
  • What FrameLayout and fragment_main.xml are you talking about? :) Why do you want to change fragment_main and activity_main? you can remove them or rename them if you want… Sorry I don't understand exactly what you mean – Martin Marconcini Mar 16 '14 at 17:48
  • Ok i've found a link to my problem. http://stackoverflow.com/questions/22289164/adt-blank-activity-created-with-fragment-activity Thank you again :) – mrgenco Mar 16 '14 at 18:04
  • 1
    Glad you found your answer. Just to reiterate. Do not remove Fragments unless you have a very good reason to do so (and I can't really find one). Even if you only have ONE activity with ONE fragment that you never change, it's a lot better, easier and modular to add your code in the Fragment. The Future You will appreciate it. – Martin Marconcini Mar 16 '14 at 18:08