Exploring Android Studio

Share this

We just developed our first app in previous post. Let’s continue
further.
In android studio you can see different windows what are they
lets check it out.

 

On left side bar you can see project explorer

 

At bottom of left sidebar there is build variants

Build: set build type for your module debug or release

 

Project explorer
After clicking project you can see following window.
It shows our project structure
Expand app module
There are three folders
manifests
java
res
below app there is one more Gradle script.
manifests:
again expand manifests folder you can see AndroidManifest.xml.Every application must have an AndroidManifest.xml file. The manifest file
provides essential information about your app to the Android system.

double click to open it.

 

In AndroidManifest.xml file the manifest and application tags
are required in the manifest file and must only appear once..ln { color: rgb(0,0,0); font-weight: normal; font-style: normal; }
.s0 { color: rgb(0,0,0); font-style: italic; }
.s1 { color: rgb(0,0,255); font-weight: bold; }
.s2 { color: rgb(0,0,0); }
.s3 { color: rgb(0,128,0); font-weight: bold; }
.s4 { color: rgb(0,0,0); }
.s5 { color: rgb(0,0,128); font-weight: bold; }

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.androidcodr.firstapp" > 
 
    <application 
        android:allowBackup="true" 
        android:icon="@mipmap/ic_launcher" 
        android:label="@string/app_name" 
        android:supportsRtl="true" 
        android:theme="@style/AppTheme" > 
        <activity android:name=".MainActivity" > 
            <intent-filter> 
                <action android:name="android.intent.action.MAIN" /> 
                <category android:name="android.intent.category.LAUNCHER" /> 
            </intent-filter> 
        </activity> 
    </application> 
 
</manifest>

 

Inside AndroidManifest.xml it contain
uses-permission: this tag requests a permission that must be
granted to the application in order for it to operate correctly. For example, if
your app use Internet—in this case you must specify the
android.permission.INTERNET permission.

package: this provides unique id for your app. No two app
have same package path.
Application
This contain following tag
android:icon — the icon for your app
android:label — the name of your app
android:theme – style for your app
activity—all the activity/screen added to your app must be
declared here. If activity not declared here your app may crash.
service: they are used to implement long-running background
operations. An example includes a network call to fetch data for your
application. Unlike activities, services have no user interface.
receiver: declares a broadcast receiver that enables
applications to receive intents broadcast by the system even when app is not
running. One example of a broadcast receiver would be alarm receiver if you want
your app to do specific task at defined time.
Java
You will see all the java files for your activity here.
Now we have only one java file here

MainActivity.java

 

Res
External resources used in app such as images, string, raw
files. Under res folder there are following folder

 

drawable:  images or
xml drawable.
layout: XML files that define a user interface layout
mipmap: drawable files for different launcher icon densities.
values: XML files that contain simple values, such as
strings, integers, and colors.
colors.xml for color values.
dimens.xml for dimension values.
strings.xml for string values.

styles.xml for styles/theme.

Gradle: It’s the new build tool that Google wants to use for Android. It’s being used due to it being more extensible, and useful than ant. It is meant to enhance developer experience.
Here you can declare minimum sdk version and targetes sdk version.
build type– release or debug
dependencies — extenal library for your app.

At the bottom bar Android monitor, Terminal, Messages

 

Android monitor: to see debug log for connected emulator
Terminal: to send terminal command.
Messages: android
messages
Designer window:

 

Palette: widgets that can be added to layout. Such as button,
checkbox, radio.

 

Component tree:

All the widgets added to your layout.

Properties: display properties of selected widgets.

 

At the bottom click Text to see XML of your Layout.

Blueprint:
 

Orientation: change orientation of emulator to Landscape or Portrait.

Emulator: see your layout in different screen sized emulator.

 

Api: set API level for emulator.

AppTheme: set different style for your app.

If you like post comment and share it


Share this

3 comments

  1. Thanks for this informative write up, I am working for mobile application development CA from last 8 months and here are my favorite features from Android studio.
    1- Gradle-based build support.
    2- Android-specific refactoring and quick fixes
    3- Lint tools to catch performance, usability, version compatibility and other problems
    4- ProGuard and app-signing capabilities
    5- Template-based wizards to create common Android designs and components.

Leave a Reply

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