2

I have been using Android ADT for a few weeks now and i used to normally create new activities by going to:File>New>Other>Android>Android_Activity>Blank_Activity. However after updating my 'Android SDK Tools' & 'Android SDK Platform Tools' today , its now showing a new option when I'm trying to create an activity.

When I select new blank activity and click next , its then showing a new form that i have to fill in which is titled as 'Fragment Layout Name'. Why has this suddenly appeared and does anyone know why I'm being forced to create a fragment layout as i don't want to even use this. I also remember one of my friends saying that he updated his SDK about a week ago and he stated that he had the same problem. Shall i just remove the fragment in the XML document once its loaded or is there a way to disable this so i wont have to go through this every-time.

rds
  • 26,253
  • 19
  • 107
  • 134
user3417643
  • 101
  • 2
  • 10
  • i assume you're refering to the ADT plugin in Eclipse and have upadted the question accordingly. If you are actually using something else, please edit it with the correct context. – rds Mar 31 '14 at 13:12

1 Answers1

3

The templates of files produced by "New ..." wizard have changed lately. Now you are enforced to create a new Activity with a Fragment placeholder attached. Guess that's the way the developers enforce people to build UI based on Fragments :)

There are a few workarounds for your problem:

1) Just delete fragment layout in your resources; delete the placeholder fragment in your Activity code and all the relevant code (FragmentManager etc); change activity layout from FrameLayout to anything you like.

2) Follow the recipe proposed in this answer

3) Don't. Ever. Use. Wizards. It is much better to create a new class and write extends Activity (or Fragment, Service, etc), than to create a template and waste your precious time changing it to your needs. And it helps to understand the lifecycle of components, too.

Community
  • 1
  • 1
Drew
  • 3,307
  • 22
  • 33