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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With