android_learners_hub
How to build your First
App?
Download Android studio from its
official site (or from https://android-studio.en.lo4d.com/windows,https://androidstudio.en.uptodown.com/windows). Then, install it in your system, after that set up SDK. To
create new project just click on new project , if you already working in a
project and want to create new project then follow the given steps(Go to File à New Project).
Step 1
Step 2
Step3
New project will be created as shown
below:
Files in your Project:-
Here you will find 2 root folders(as shown in left side of above image) in
your project. First is app ,app have all the files for your project .
This is further divided into 3 parts
1. Manifest File:- It acts as the Boss of the app. Everything
used in the app is defined hear (all android components) .Every Android app must
include a file called AndroidManifest.xml at its root. The manifest file
contains essential information about the app, such as what components it
contains, required libraries, and other declarations.
2. Java File:- The java folder contains any Java code
you write. Every java class is that you created is here. Even if you what to
create a new java just left click on this folder and click on new java file.
The file will be created.
3. Res File:- You can find app resources in the res
folder. For example, the layout subfolder contains layouts, and the values
subfolder contains resource files for values such as Strings. You can get other
types of resources too.
Following are the other main files in app folder, with which you will deal later:-
MainActivity.java defines an activity. An
activity tells Android how the app should interact with the user.activity_main.xml
defines a layout. A layout tells Android how your app should look.
strings.xml is a String resource
file. It includes Strings(Text) such as the app’s name and any default text
values saved by just giving it a name as an attribute. Other files such as
layouts and activities can look up text values from here.
The second root folder is Gradle, which
is an open source tool provide high performance, flexible, Extensibility and
son on.
It have gradle file for app, project and
many other things as shown below.
Gradle App: - It consist of the
information related to app like minsdk, maxsdk, targetsdk versions and other
dependencies.
Gradle Project: - It
consists of Top-level
build file where you can add configuration options common to all
sub-projects/modules.
Your project will look similar as shown in the image below. Now, you will
just get hello World printed in your activity when you run your app.
So, this was all about how
you can create a new project in android studio. In the next post(Build your First App Part 2 (onlyjavaforall.blogspot.com)) we will cover view and View Group (TextField , Button and layouts) .For any query feel free to comment.
-----------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
👍 Great
ReplyDelete