I dont want to use fragments and fragment layout. Is this possible to disable eclipse's that property? Firstly, i create a class and xml files then i declare them in Android Manifest file this works for me but it takes a long time if i can disable it, it will be easier.
-
Start making a project with empty Android template? – Raptor Mar 10 '14 at 09:23
-
I've already made a project with empty Android template. After i updated my eclipse, it creates fragment layout automatically. – Burak Mar 10 '14 at 09:36
-
I've edited my question, there are screenshots, where is my mistake? – Burak Mar 10 '14 at 09:41
-
possible duplicate of [ADT blank activity created with fragment activity..](http://stackoverflow.com/questions/22289164/adt-blank-activity-created-with-fragment-activity) – Daniel Bank Mar 21 '14 at 14:17
-
download previous version here: http://thepiratebay.se/torrent/8648344/Android_SDK_r22.0.1_Full – vuhung3990 Jun 01 '14 at 23:54
11 Answers
While creating new Application, just copy the Layout Name to the Fragment Layout Name(eg:activity_main)
Voila! You get an activity without the fragment part.
remove this part of the code from activity
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
Clean the project.

- 492
- 1
- 8
- 19
Eclipse provides a facility to create a Simple Android Application which does not contains any Fragment
classes or Layout files.
You can just create simple project besides selecting any kind of templates for the project.

- 29,068
- 10
- 64
- 102
-
-
Which ADT you are having ? I guess now the latest ADT have kept the functionality of adding the layout of fragments into the default structure also. That is why its showing options to add the fragment layout name. Whereas it doesnot show in my eclipse. – GrIsHu Mar 10 '14 at 09:46
-
-
-
-
If you do not want to create a fragment then you can simply that classes from your structure. – GrIsHu Mar 10 '14 at 09:54
-
I know i can do that but i don't want to do this every time. I think it mustn't be mandatory. – Burak Mar 10 '14 at 09:57
-
Yes i know it must not be mandatory but if its added into latest ADT then it will always come by default. As i can see in your SS it has made compulsory to add the name of fragment class also. – GrIsHu Mar 10 '14 at 10:02
-
Also i don't know why did he/she vote down my question. If you have any idea you DO NOT do anything. Whatever, thank you for your ideas @GrlsHu – Burak Mar 10 '14 at 10:15
Create a Blank Activity project
with Navigation type as none and other entries as default.
Copy the contents of fragment_main.xml
into activity_main.xml
and delete the fragment _main.xml
Now go to MainAcitvity.java
remove only this portion from MainActivity
onCreate()
method:
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
finally remove class PlaceholderFragment{}
and its contents from MainActivity.java
and then run your application.
There appears to be no setting to accomplish what you want at the moment (I agree there should be one). As a workaround, this answer to a similar question shows how to remove fragments from the newly created project. https://stackoverflow.com/a/22482259/1287459
You might wanna try this. ADT blank activity created with fragment activity..
It works fine for me, when it comes to creating blank activities, without fragments.
I done it by replacing the BlankActivity(22.6.2) folder to the older sdk BlankActivity(22.6.1) present in the tools/templates directory in android-sdk.

- 149
- 7
- First you need to downgrade your ADT plugin for eclipse :
Go to Help > Install New Sofware... and click on the blue link : What is already installed ?
Then select "Tracer for OpenGL ES" and all the Softwares containing "Android" and click Uninstall. When it's done, download ADT plugin for eclipse (revision 22.3.0) here :
http://dl.google.com/android/ADT-22.3.0.zip
Now we are going to install it in eclipse. Go to Help > Install New Sofware... and click on "Add" and then "Archive". Browse the archive we have just download and click "OK". Select all the items in the list and click "Next". - At this time you need to downgrade your android sdk tools :
First remove your android sdk tools folder.
Then download the tools (revision 22.3) here :
http://dl-ssl.google.com/android/repository/tools_r22.3-windows.zip
Then extract it and copy the tools folder inside your android sdk folder.
Do not update eclipse ADT plugin and android tools (in sdk manager).
Choose Empty Activity instead of creating Blank Activity if you don't find the Empty Activity option, you have chosen a newer version of the software instead of the updated version software.

- 156
- 13
You just put the same name that your "Layout Name" in "Fragment Layout Name" and the wizard will not create the fragment file
When you are creating a new Android Application Project using the wizard, after you get to the screen that asks you to select type of activity, choose Empty Activity instead of Blank Activity, which is the default.
No fragments will be created.

- 6,492
- 9
- 46
- 76