{"id":267,"date":"2023-05-16T12:49:34","date_gmt":"2023-05-16T12:49:34","guid":{"rendered":"https:\/\/itnotes.apjsoftwares.com\/?p=267"},"modified":"2023-05-16T12:49:34","modified_gmt":"2023-05-16T12:49:34","slug":"2-1-creating-application-template","status":"publish","type":"post","link":"https:\/\/itnotes.apjsoftwares.in\/index.php\/2023\/05\/16\/2-1-creating-application-template\/","title":{"rendered":"2.1 Creating application template"},"content":{"rendered":"\n<p>For creating the simple example:<\/p>\n\n\n\n<ol>\n<li>Create the new android project<\/li>\n\n\n\n<li>Write the message (optional)<\/li>\n\n\n\n<li>Run the android application<\/li>\n<\/ol>\n\n\n\n<p>You need to follow the 3 steps mentioned above for creating the Hello android application.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1) Create the New Android project<\/strong><\/h3>\n\n\n\n<p>For creating the new android studio project:<\/p>\n\n\n\n<p>1) Select Start a new Android Studio project<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"477\" height=\"492\" src=\"https:\/\/itnotes.apjsoftwares.com\/wp-content\/uploads\/2023\/05\/image-57.png\" alt=\"\" class=\"wp-image-268\" srcset=\"https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-57.png 477w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-57-291x300.png 291w\" sizes=\"(max-width: 477px) 100vw, 477px\" \/><\/figure>\n\n\n\n<p>2) Provide the following information: Application name, Company domain, Project location and Package name of application and click next.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"916\" height=\"652\" src=\"https:\/\/itnotes.apjsoftwares.com\/wp-content\/uploads\/2023\/05\/image-58.png\" alt=\"\" class=\"wp-image-269\" srcset=\"https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-58.png 916w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-58-300x214.png 300w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-58-768x547.png 768w\" sizes=\"(max-width: 916px) 100vw, 916px\" \/><\/figure>\n\n\n\n<p>3) Select the API level of the application and click next.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"916\" height=\"652\" src=\"https:\/\/itnotes.apjsoftwares.com\/wp-content\/uploads\/2023\/05\/image-61.png\" alt=\"\" class=\"wp-image-272\" srcset=\"https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-61.png 916w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-61-300x214.png 300w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-61-768x547.png 768w\" sizes=\"(max-width: 916px) 100vw, 916px\" \/><\/figure>\n\n\n\n<p>4) Select the Activity type (Empty Activity).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"916\" height=\"652\" src=\"https:\/\/itnotes.apjsoftwares.com\/wp-content\/uploads\/2023\/05\/image-59.png\" alt=\"\" class=\"wp-image-270\" srcset=\"https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-59.png 916w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-59-300x214.png 300w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-59-768x547.png 768w\" sizes=\"(max-width: 916px) 100vw, 916px\" \/><\/figure>\n\n\n\n<p>5) Provide the Activity Name and click finish.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"916\" height=\"652\" src=\"https:\/\/itnotes.apjsoftwares.com\/wp-content\/uploads\/2023\/05\/image-64.png\" alt=\"\" class=\"wp-image-275\" srcset=\"https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-64.png 916w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-64-300x214.png 300w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-64-768x547.png 768w\" sizes=\"(max-width: 916px) 100vw, 916px\" \/><\/figure>\n\n\n\n<p>After finishing the Activity configuration, Android Studio auto generates the activity class and other required configuration files.<\/p>\n\n\n\n<p>Now an android project has been created. You can explore the android project and see the simple program, it looks like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"825\" height=\"354\" src=\"https:\/\/itnotes.apjsoftwares.com\/wp-content\/uploads\/2023\/05\/image-63.png\" alt=\"\" class=\"wp-image-274\" srcset=\"https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-63.png 825w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-63-300x129.png 300w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-63-768x330.png 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2) Write the message<\/strong><\/h3>\n\n\n\n<p>File: activity_main.xml<\/p>\n\n\n\n<p>Android studio auto generates code for activity_main.xml file. You may edit this file according to your requirement.<\/p>\n\n\n\n<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&lt;android.support.constraint.ConstraintLayout xmlns:android=&#8221;http:\/\/schemas.android.com\/apk\/res\/android&#8221;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;xmlns:app=&#8221;http:\/\/schemas.android.com\/apk\/res-auto&#8221;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;xmlns:tools=&#8221;http:\/\/schemas.android.com\/tools&#8221;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;android:layout_width=&#8221;match_parent&#8221;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;android:layout_height=&#8221;match_parent&#8221;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;tools:context=&#8221;first.javatpoint.com.welcome.MainActivity&#8221;&gt;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;TextView&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;android:layout_width=&#8221;wrap_content&#8221;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;android:layout_height=&#8221;wrap_content&#8221;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;android:text=&#8221;Hello Android!&#8221;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;app:layout_constraintBottom_toBottomOf=&#8221;parent&#8221;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;app:layout_constraintLeft_toLeftOf=&#8221;parent&#8221;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;app:layout_constraintRight_toRightOf=&#8221;parent&#8221;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;app:layout_constraintTop_toTopOf=&#8221;parent&#8221; \/&gt;&nbsp;&nbsp;<\/p>\n\n\n\n<p>&lt;\/android.support.constraint.ConstraintLayout&gt;&nbsp;&nbsp;<\/p>\n\n\n\n<p>}&nbsp;&nbsp;<\/p>\n\n\n\n<p>File: MainActivity.java<\/p>\n\n\n\n<p>package first.javatpoint.com.welcome;&nbsp;&nbsp;<\/p>\n\n\n\n<p>import android.support.v7.app.AppCompatActivity;&nbsp;&nbsp;<\/p>\n\n\n\n<p>import android.os.Bundle;&nbsp;&nbsp;<\/p>\n\n\n\n<p>public class MainActivity extends AppCompatActivity {&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;@Override&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;protected void onCreate(Bundle savedInstanceState) {&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;super.onCreate(savedInstanceState);&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setContentView(R.layout.activity_main);&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<\/p>\n\n\n\n<p>} &nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3) Run the android application<\/strong><\/h3>\n\n\n\n<p>To run the android application, click the run icon on the toolbar or simply press Shift + F10.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"423\" height=\"96\" src=\"https:\/\/itnotes.apjsoftwares.com\/wp-content\/uploads\/2023\/05\/image-60.png\" alt=\"\" class=\"wp-image-271\" srcset=\"https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-60.png 423w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-60-300x68.png 300w\" sizes=\"(max-width: 423px) 100vw, 423px\" \/><\/figure>\n\n\n\n<p>The android emulator might take 2 or 3 minutes to boot. So please have patience. After booting the emulator, the android studio install the application and launches the activity. You will see something like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"270\" height=\"480\" src=\"https:\/\/itnotes.apjsoftwares.com\/wp-content\/uploads\/2023\/05\/image-62.png\" alt=\"\" class=\"wp-image-273\" srcset=\"https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-62.png 270w, https:\/\/itnotes.apjsoftwares.in\/wp-content\/uploads\/2023\/05\/image-62-169x300.png 169w\" sizes=\"(max-width: 270px) 100vw, 270px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>For creating the simple example: You need to follow the 3 steps mentioned above for&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/267"}],"collection":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/comments?post=267"}],"version-history":[{"count":1,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/267\/revisions"}],"predecessor-version":[{"id":276,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/267\/revisions\/276"}],"wp:attachment":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/media?parent=267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/categories?post=267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/tags?post=267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}