Android – Creating First New Project – 2

This tutorial is the continuation of this tutorial Android – Creating First New Project – 1. In the previous tutorial we learnt to create a new Android Project. Here In this tutorial first of all we will learn about the project structure and then we will learn about the coding in Java and XML and run our app. 

After creating our new project we will get the project structure as shown in image.

Now we will learn about some basic files in project structure.

  • src – Directory for your app’s main source files. By default, it includes an Activity class that runs when your app is launched using the app icon.
  • gen – It contains auto generated code like This files creates a link between your activity file (java file) and layout file (xml file).
  • res –  It contains several sub directories for app resources –
    • drawable-hdpi/ldpi/mdpi/xhdpi/xxhdmi –Directory for drawable objects (such as bitmaps) that are designed for high-density (hdpi) ,low-density (ldpi), medium-density (mdpi), extra high-density (xhdpi) and double extra high-density (mdpi) screens.
    • Layout – Directory for files that define your app’s user interface.
    • Values – Directory for other various XML files that contain a collection of resources, such as string definitions.
  • Manifest file – The manifest file describes the fundamental characteristics of the app and defines each of its components.

Here we are going to make an app in which there will be three objects – EditText, TextView and Button. EditText is just a text box where we input something, TextView is just a lable where we can display any kind of text, and you must be familiar about the work of Button. Here we will enter any text inside the EditText and click on the button, after clicking the text that we have entered must be printed on the TextView. So this is what we are going to make in this app. So let’s start !!

1. First of all we will create our layout. So go to res –> layout –> activity_main.xml and double click on this file.

2. Now copy and paste the code there as given below.

3. Now save the file with combination of ctrl+s and close the file.

4. So now our layout will look like this as shown in figure.

5. Now go to src –> com.apptronix.firstproject –> and open this file.

6. Now copy and paste the code there as given below.

7. Now save the file with combination of ctrl+s and close the file.

8. Now we have to run the file. Right click on project, go to Run As –> Android Application.

Complete Video Tutorial :

Thank you for visiting our tutorial. If you have any doubts or queries regarding this, you can comment below in our comment section. Don’t forget to share the tutorial if you like it.

Previous Part : Android – Creating First New Project – 1

Share this post

Comments (3)

  • job search Reply

    Excellent article! We are linking to this great content on our website. Keep up the great writing.

    June 25, 2017 at 4:54 pm
  • student loans Reply

    I would like to thank you for the efforts you’ve put in writing this site. I really hope to view the same high-grade blog posts by you later on as well. In fact, your creative writing abilities has encouraged me to get my own, personal website now 😉

    June 28, 2017 at 12:16 am
  • career guidance Reply

    Hey! Someone in my Myspace group shared this site with us so I came to take a look. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Excellent blog and wonderful style and design.

    June 29, 2017 at 3:29 am

Leave a Reply

Your email address will not be published. Required fields are marked *