Develop your first Android application for beginers

Develop your first Android Application

1. Download Android Studio 

Search on google android studio download like given below in screenshot



Download and install it on your machine. After finished installation it will download SDK automatically so keep your internet connection on.

2. Open Android Studio

Click on create new project like given below


Now you have to Rename your application and set language as a java and set file location. Don't change other details. keep minimum SDK Jelly Bean as Default because if you set latest SDK your application will run on 99.99% devices.


Now select empty activity and click on next button.


If you have question why my Android Studio theme is dark. I have changed it in settings I will show you in another blog in details. Let,s see how we can create our first android app. We will develop it in java. After finished gradle built process you will see auto generated java code like given below.



3. Start Designing and Coding First Android App

I am just introduced you with some basic concepts. You can see below there is one java file and other XML file. In java file we write code of whatever we design in XML and XML file is used to design layouts of android apps.

Java File

XML File

Now we are going to develop Unit Converter app Meter to Centimeter Converter. I know this is basic app but keep in mind this is your starting stay with me and start design.
Let's first of all we are goning to create layout.

Click on hello world in layout and press delete button. After deleting drag new textview and constrain it by four sides.


Now connect your mobile with USB then go to your mobile settings turn on USB Debugging your android studio will detect it. Now Run it. If you can'nt find USB Debugging then search on google with your mobile name how to enable usb debugging on ( Device name ).

Next step is drag number view from text palette.


Now drag another text view from palette and constraint it with each other. For do that you can simply drag arrow from one point to another point. Constraint it vertically and horizontally.


Now drag the button from common palette and constraint it (in simple language connect the spring to the each near point) such as given in screenshots.


Now we will change some attributes first of all change the text of first textview. Search in attributes (text) as per given below.


Now change the size of textview.


Now bold the text view Search in attributes (bold) and mark it as per given below.


Now click on second text view and remove text from attributes. you know the process now how you can. 


Now change the text color of second textview. (search color in serch box of attributes.)


If you have desing like given below then you can change it. you can put only design or bueprint also.


Run your app and your design result is given below.


In my case TextView text is available but if you remove text from second textview it will be vanished.

Let's move towards java code now we will see how we can perform some calculations on this layout, for that we need to java code. Click on main_activity.java


Now import all views included in layout such as given below.


If you facing problem while importing then press Alt + Enter button as per given below. Android Studio will aso give you notification if you hover on it.


Now find these views from their id after importing like given below. (Note: code will auto complete)


Second step


Understand this editTextNumber will receive input from user and textView2 will show the result in centimeter and button will calculate. Now we will coding of button. Set on click listener.
while writting new View Android Studio will give suggession press enter code will auto complete.


Code will auto complete as per given below.


Let's start coding of like given below. Note that everytime if you run app then wait till finished gradle built.


Now run your app. It will show the result like given below.





4. How to share app with your friends

First of all Rebuild your project and wait till gradle built finished.


After finished gradle built close the project.


Go to file manager and open the folder which you were saved the project. follow the path Myfirstapplication\app\build\outputs\apk\debug and share app-debug file with your friends.
Say your friends to install this app. If you sucessfully build your first app then write sucessfully done in comments. 



Congratulations! guy's you have sucessfully build your first app if not you got fair idea about android development. Go ahead and explore the things.








Comments

Post a Comment