icebp
icebp

Reputation: 1709

Android Studio Blank Activity

I'm using Android Studio 2.1 and there is no Blank Activity option. I've seen people asking about this, and the general advice was "make one yourself". The thing is that I know nothing about Android development so I'm following this tutorial http://developer.android.com/training/basics/firstapp/creating-project.html that should take me through the basic steps (at least it seems that it will do that). So I'm trying to keep things in line with what they do there. So should I go with Empty Activity or Basic Activity? I tried them both and from what I undestand there are little differences between them, but Empty Activity sounds more like a clean startup activity than Basic. I don't know. What should I do?

Upvotes: 2

Views: 30476

Answers (6)

Richaldson
Richaldson

Reputation: 1

enter image description here

Select File --> Settings

enter image description here

Select "Plugins" from that window

1.) Android NDK Support 2.) Android Support

check there any Tick Mark. Make Tick mark them, if no tick Marked . Then Rebuild Your App. or Close android studio and reopen

Upvotes: 0

Oussema Aroua
Oussema Aroua

Reputation: 5339

Empty Activity is the same as Blank Activity. It will gives you .xml file that will be your layout where you put your Buttons or EditTexts and .java file where you will code your activity.
But Basic Activity will gives you two .xml files, the main_activity.xml that contain FloatingActionButton and a ToolBar and it will include the second .xml where you will put your Buttons and one .java file .
If you are new at android developing start with Empty Activity it's more simple to understand

Upvotes: 4

Anus Kaleem
Anus Kaleem

Reputation: 564

Basic Activity comes with FloatingActionButton and menu layout. Empty Activity does not contain FloatingActionButton and menu xml layout, although you can add them manually when you feel so. What I feel is that Basic Activity is preferable because when you created Empty Activity and want to add menu in your activity it become rather difficult to add menu xml layout manually. I have personally encounter problems while adding menu xml manually.

Upvotes: 0

Nooblhu
Nooblhu

Reputation: 572

I had the same question so I've compared the old blank activity template (according to a video tutorial I watched) with the 'empty' and the 'basic' activities templates of the new Android Studio.

The empty activity has only 2 options: "Activity Name" and "Layout Name".

enter image description here

Meanwhile Basic activity has 4 options, just like the "blank activity" template of the old Android Studio version as you can see below:

enter image description here

enter image description here

So, I would go with the basic template and manage the extra code until I need it.

Upvotes: 2

Andritchi Alexei
Andritchi Alexei

Reputation: 1440

If you want to keep things in line with what they do there, you should go with Basic Activity because in the third step of that tutorial you'll need content_my.xml which won't be generated if you choose Empty Activity at start (of course you can put your code in activity_main.xml which is pretty the same thing). So if you only want to go in line with the tutorial you choose Basic Activity. The difference between previous Blank Activity and current Basic Activity is the extra code generated in your activity like:

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });

Upvotes: 4

Abubakar
Abubakar

Reputation: 346

If you go with BaseActivity, it is also kind of empty activity. It would have only a root element in its layout. So you can start with any of the Basic or Empty.

Upvotes: 1

Related Questions