Android heard our voice :).
Just upgrade or download ADT version to 23.0.2 or higher.
Now you can choose blank activity like this,
سؤال
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.
المحلول 8
Android heard our voice :).
Just upgrade or download ADT version to 23.0.2 or higher.
Now you can choose blank activity like this,
نصائح أخرى
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.
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.
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.
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.
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.