Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i create a New Activity from IntelliJ?

How can i create a new Activity from IntelliJ for Android PRoject, and this automatically generates xml File and .Class

This is an image from my IntelliJ

like image 598
Gilberto Ibarra Avatar asked Sep 06 '13 01:09

Gilberto Ibarra


People also ask

How do I create a project from an existing source in IntelliJ?

Create a project from existing sources Launch IntelliJ IDEA. If the Welcome screen opens, press Ctrl+Shift+A , type project from existing sources , and click the Import project from existing sources action in the popup. Otherwise, from the main menu, select File | New | Project from Existing Sources.

How do I create an empty activity?

Step 1: Firstly, click on app > res > layout > Right Click on layout. After that Select New > Activity and choose your Activity as per requirement. Here we choose Blank Activity as shown in figure below. Step 2: After that Customize the Activity in Android Studio.


2 Answers

Choose the class from the source folder where you want to create the activity.

Right click.

Choose New > Android Component.

In the New Android Component Dialogue choose Kind > Activity.

Name your Activity and save. You will get a Java source file created that extends Activity and <activity android:name=".view.Sample"/> line in the AndroidManifest.xml.

enter image description here

like image 161
Eric H. Avatar answered Sep 23 '22 04:09

Eric H.


From the first look, highlight the src folder and click new. currently you have highlighted the layout folder, so it might provide you only those files thats meant to go there.

You can create a java class in src folder which extends the "activity" class.

like image 37
prijupaul Avatar answered Sep 26 '22 04:09

prijupaul