0% found this document useful (0 votes)
9 views14 pages

Android Practical File

The document outlines practical exercises related to Android app development, including installation of Android Studio and understanding the Android SDK components. It covers Java programming concepts such as constructors, final, this, and static keywords, along with the directory structure of an Android project and common resource files. Additionally, it provides examples of XML resource files like colors.xml, dimens.xml, strings.xml, and styles.xml used in Android development.

Uploaded by

kikoh33866
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views14 pages

Android Practical File

The document outlines practical exercises related to Android app development, including installation of Android Studio and understanding the Android SDK components. It covers Java programming concepts such as constructors, final, this, and static keywords, along with the directory structure of an Android project and common resource files. Additionally, it provides examples of XML resource files like colors.xml, dimens.xml, strings.xml, and styles.xml used in Android development.

Uploaded by

kikoh33866
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

INDEX

Seri Name of the Practical Date of Date of Remar


al allotment Submission ks
No.
01. Installation of Java, android
framework.
02. Android SDK Manager and its all
components
O3. Program Based on overriding,
constructor, classes in java
04 Program based on the final, this
and static keyword in JAVA.
05 Directory Structure of an android
project, common default
resources folders the values
folder, leveraging Android XML
06
07
08
09
10
11
12
13
14
15
16
17
18
19
Practical 1 – Installation of Java, android framework
The public integrated development environment (IDE) for Android apps is Android
Studio, which is supported by Google. Java was replaced by kotlin on May 7, 2019,
which became the preferred language for Android apps. But still, Java is being used
to develop Android apps. Android Studio 3.6.1 has the following features.

• Gradle-based build support.

• Drag and drop objects in the Layout Editor allow you to create UI components.

• Common Android programs and features can be created using template-based


wizards.

• Built-in support for Google Cloud Platform enabling integration with Firebase Cloud
Messaging (formerly known as ‘Google Cloud Messaging’) and Google App Engine.

• Lint tools to capture performance, usage, version compatibility, and other


information.

system requirements

The following requirements are necessary before downloading and installing Android
Studio.

• Operating System Version - Microsoft Windows 7/8/10 (32-bit or 64-bit).

• Random Access Memory (RAM) - A minimum of 4 GB RAM and 8 GB RAM is


recommended.

• Free disk space - minimum 2 GB and


recommended 4 GB.

• Minimum JDK version - Java Development


Kit (JDK) .

• Minimum screen resolution -


1280*800.resolution

Installing Android Studio


Step 1

To download Android Studio, visit the official


Android Studio website on your browser.

Step 2

Click on the "Download Android Studio"


option.

Step 3

Double-click the downloaded "Android


Studio-ide.exe" file

Step 4

The "Android Studio Setup" screen appears


and you can click "Next" to continue.

Step 5

Select the component you want to install


and click the "Next" button.

Step 6
Now, find the location where you want to install Android Studio and click "Next" to
proceed.

Step 7

Select the start menu folder for the


"Android Studio" shortcut and click the
"Install" button to proceed

Step 8

Click on the "Next" button after


successfully completing the installation

Step 9

Click the "Finish" button to continue.


Then, your Android Studio welcome screen will appear on screen.

Practical 2 –Android SDK Manager and it’s all components.


Android SDK is a group of libraries and Software Development tools which might be
vital for Developing Android Applications. Whenever Google releases a new edition or
update of Android Software, a corresponding SDK also releases with it. In the up to
date or new version of SDK, some greater capabilities are blanketed which are not
gift in the previous model. Android SDK consists of a few gear which are very critical
for the improvement of Android Application. These equipment offer a clean float of
the development system from developing and debugging. Android SDK is like
minded with all working systems consisting of Windows, Linux, macOS, etc.

Components of Android SDK

Android SDK Components play a foremost function within the Development of


Android applications. Below are the essential components:

1. Android SDK Tools

Android SDK device is an essential aspect of Android SDK. It consists of a complete


set of development and debugging equipment. Below are the SDK developer
equipment:

• Android SDK Build tool.

• Android Emulator.

• Android SDK Platform-gear.

• Android SDK Tools.


2.

Android SDK Build-Tools

Android SDK construct equipment are used for constructing actual binaries of
Android App. The primary capabilities of Android SDK Build tools are built, debug, run
and take a look at Android programs. The cutting-edge model of the Android SDK
Build device is 30.0.3. While downloading or updating Android in our System, one
ought to ensure that its latest model is down load in SDK Components.

3. Android Emulator

An Android Emulator is a tool that simulates an Android device in your system.


Suppose we need to run our android software that we code. One alternative is that
we will run this on our Android Mobile with the aid of Enabling USB Debugging on our
mobile. Another option is to use an Android Emulator. In Android Emulator, we are
shown a virtual android device on our system in which we run the Android
application we code.
4. Android SDK platform tools

Android SDK Platform-tools are helpful while working on Project and error messages
will be shown at the same time. It is mainly used for testing purposes. This includes:

• Android Debug Bridge (ADB), a command-line tool that helps communicate with the
device. It allows us to perform actions like Installing App and Debugging App.

• Fastboot allows you to flash the device with a new system image.

• Systrace tools help compile and manage systems. Very important for App
Debugging.

5. Android SDK tools

The Android SDK tool is part of the SDK tool. It has some tools and other utilities
which are important for developing Android application. It has complete Debugging
and Development tools for android.

6. SDK settings

These are numbered according to Android version. The new version of the SDK
platform has more features and is more compatible but the older version is less
compatible with fewer features. As in Android 11.0(R) it is more compatible and has
more features but below versions like Android 10.0(Q), Android4.4(KitKat) have
fewer features and not compatible it is more consistent.
7. SDK update sites

SDK Update Sites have some built-in sites to check Android SDK Updates Tools. In
this case, we need to make sure that we do not uncheck the bottom button because
these are checked by default which will check for updates if we remove it it will not
check for updates for them.

Practical 3 –Program Based on overriding, constructor,


classes in java
public class Student {
//instance variables of the class
int id;
String name;

Student(){
System.out.println("this a default constructor");
}

Student(int i, String n){


id = i;
name = n;
}

public static void main(String[] args) {


//object creation
Student s = new Student();
System.out.println("\nDefault Constructor values: \n");
System.out.println("Student Id : "+s.id + "\nStudent Name : "+s.name);
System.out.println("\nParameterized Constructor values: \n");
Student student = new Student(10, "David");
System.out.println("Student Id : "+student.id + "\nStudent Name : "+student.name)
;
}
}
OUTPUT

this a default constructor

Default Constructor values:

Student Id : 0
Student Name : null

Parameterized Constructor values:

Student Id : 10
Student Name : David

Practical 4- Program based on the final, this and static


keyword in JAVA.
The final keyword in java is used to restrict the user. The java final key-word may be
used in many context. Final can be:

1. Variable

2. Method

3. Class

The final keyword can be applied with the variables, a final variable that have no
value it is called blank final variable or uninitialized final variable. It can be initialized
in the constructor only.

Example of final variable


class Bike9{
final int speedlimit=90;//final variable
void run(){
speedlimit=400;
}
public static void main(String args[]){
Bike9 obj=new Bike9();
obj.run();
}
}//end of class

OUTPUT

The static keyword in Java is specially used for reminiscence control. The static
keyword in Java is used to percentage the same variable or approach of a given
class. The customers can observe static keywords with variables, techniques, blocks,
and nested classes. The static key-word belongs to the class than an example of the
magnificence. The static keyword is used for a constant variable or a technique that
is the equal for every instance of a class.

Program to demonstrate use of static keyword with methods and variables

class Student {
String name;
int rollNo
// static variable
static String cllgName;

// static counter to set unique roll no


static int counter = 0;

public Student(String name)


{
this.name = name;

this.rollNo = setRollNo();
}

// getting unique rollNo


// through static variable(counter)
static int setRollNo()
{
counter++;
return counter;
}

// static method
static void setCllg(String name) { cllgName = name; }

// instance method
void getStudentInfo()
{
System.out.println("name : " + this.name);
System.out.println("rollNo : " + this.rollNo);

// accessing static variable


System.out.println("cllgName : " + cllgName);
}
}
Output
// Driver class
public class StaticDemo { name : Alice
public static void main(String[] args) rollNo : 1
{
cllgName : XYZ
// calling static method
// without instantiating Student class name : Bob
Student.setCllg("XYZ"); rollNo : 2
cllgName : XYZ
Student s1 = new Student("Alice");
Student s2 = new Student("Bob");
s1.getStudentInfo();
s2.getStudentInfo() }}
Program 5- Directory Structure of an android project, common
default resources folders the values folder, leveraging Android
XML

Directory Structure of an android project

• src - Java source documents related to your project. This includes the Activity
"controller" documents as well as your models and helpers.

• res - Resource files related to your mission. All pics, strings, layouts, and different
resource files are saved within the aid document hierarchy below the res listing.

• res/format - XML layout documents that describe the views and layouts for each
pastime and for partial views inclusive of list objects.

• res/values - XML documents which keep numerous characteristic values. These


encompass strings.Xml, dimens.Xml, styles.Xml, colorations.Xml, themes.Xml, and
so on.
• res/drawable - Here we shop the various density-impartial graphic property used in
our software.

• res/drawable-hdpi - Series of folders for density precise photos to use for


numerous resolutions.

• res/mipmap - most generally used for application icons. See this segment for extra
information.

The most frequently edited files are:

• res/layout/activity_foo.Xml - This record describes the format of the activity's UI.


This method the location of each view item on one app display.

• src/.../FooActivity.Java - The Activity "controller" that constructs the


pastime using the view, and handles all event coping with and examine good
judgment for one app display.

• AndroidManifest.Xml - This is the Android software definition file. It consists of


statistics approximately the Android utility along with minimum Android model,
permission to access Android tool abilties which includes internet get admission to
permission, ability to use phone permission, and so on.

Other less edited folders include:

• gen - Generated Java code files, this library is for Android internal use only.

• assets - Uncompiled supply documents related to your project; Rarely used.

• bin - Resulting utility bundle documents associated with your assignment as soon
as it’s been built.

• libs - Before the advent of Gradle construct system, this listing become used for
any secondary libraries (jars) you may want to link to your app.

Common default resources folders the values folder

The res/values folder is used to keep the values for the resources which can be used
in many Android tasks to consist of functions of coloration, patterns, dimensions etc.
Colorings.Xml: The colorings.Xml is an XML report that's used to keep the colors for
the sources. An Android project contains three essential colorings namely:

• colorPrimary

• colorPrimaryDark

• colorAccent

The implementation of colors.xml resource:


<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#1294c8</color>
<color name="colorPrimaryDark">#1294c8</color>
<color name="colorAccent">#FF4081</color>
<color name="text_color">#555555</color>
<color name="colorText">#FFFFFF</color>
<color name="colorTextHint">#51d8c7</color>
</resources>

dimens.xml: The dimens.xml is used for defining the dimensions for different
widgets to be included in the Android project. It is a good coding practice to use
dimens.xml to define a dimension rather than just writing the dimension in the
resource, due to the fact that if ever any need arises to change the dimension,
instead of making a change to all, only the dimens.xml can be changed once and
the change is reflected in all.
The implementation of dimens.xml resource:
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="nav_header_vertical_spacing">8dp</dimen>
<dimen name="nav_header_height">176dp</dimen>
<dimen name="fab_margin">16dp</dimen>
</resources>

strings.xml: One of the most important as well as widely used values file is the
strings.xml due to its applicability in the Android project. Basic function of the
strings.xml is to define the strings in one file so that it is easy to use same string in
different positions in the android project plus it makes the project looks less messy.
The implementation of strings.xml resource:
<resources>
<string name="app_name">Workshop app</string>

<string name="navigation_drawer_open">Open navigation


drawer</string>
<string name="navigation_drawer_close">Close navigation
drawer</string>
<string name="action_settings">Settings</string>
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="date">Date:</string>
<string name="timings">Timings:</string>
</resources>

styles.xml: Another important file in the values folder is the styles.xml where all the
themes of the Android project are defined. The base theme is given by default
having the option to customize or make changes to the customized theme as well.
Every theme has a parent attribute which defines the base of the theme. There are
a lot of options to choose from depending on the need of the Android project.
The implementation of styles.xml resource:
<resources>

<!-- Base application theme. -->


<style name="AppTheme"
parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item
name="colorPrimary">@color/colorPrimary</item>
<item
name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item
name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay"
parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay"
parent="ThemeOverlay.AppCompat.Light" />
</resources>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy