Question

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.

http://i.hizliresim.com/KgMJvQ.png

Was it helpful?

Solution 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,

enter image description here

OTHER TIPS

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.

  • 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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top