0% found this document useful (0 votes)
6 views32 pages

AppDev WK2

The document provides a comprehensive introduction to Android Studio, covering installation, project structure, and basic input/output functionalities. It details the setup process for Android phones in developer mode, the organization of project files, and essential components like the Manifest, Java, and Resource folders. Additionally, it includes key notes on UI elements such as TextView, EditText, and Button, along with example code snippets for practical understanding.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views32 pages

AppDev WK2

The document provides a comprehensive introduction to Android Studio, covering installation, project structure, and basic input/output functionalities. It details the setup process for Android phones in developer mode, the organization of project files, and essential components like the Manifest, Java, and Resource folders. Additionally, it includes key notes on UI elements such as TextView, EditText, and Button, along with example code snippets for practical understanding.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

Application

Development
Introduction to Android Studio
Agenda
• How to Install Android Studio

• Virtualization

• Android Phone Setup

• Project Structure

• Basic Input

START 05/21/2025 2
Android
Studio
First Steps into Mobile
Development

START 05/21/2025 3
Installation

• Download the latest • Open the setup file


Android Studio @ • Proceed to open
Download Android Stud Android Studio after
io & App Tools - Android
Developers installation
• Current version is Koala • Proceed to download
anything required for
the IDE to work.

START 05/21/2025 4
Installation

• Those would be the ff.: • Don’t worry after


• Android SDK download and
installation of these
• Gradle
files all should work
• Kotlin fine even while working
• Android Repositories offline.
(too many to list)

START 05/21/2025 5
First Project

• Create an initial project • Once at the IDE, Create


so you can open the a Device.
IDE. • This will require you to
• Select the Empty Views install another plugin
Activity Intel HAXM, which will
• Choose Java as be used to optimize
language Virtualization.
Virtualization

START 05/21/2025 6
Virtualization
is a technology that
allows the creation of
multiple simulated
environments or
dedicated resources from
a single physical
hardware system.

START 05/21/2025 7
Android
Studio
What if we want to run on our
mobile device?

START 05/21/2025 8
Android Phone Setup

• First setup your android • Keep tapping it until a


phone in developer notification of how many
mode. taps left until you become
a developer.
• This is done by going
• Now your phone is in
to Settings -> About
developer mode (that can
• Look for the android now be toggled at
version settings)

START 05/21/2025 9
Android Phone Setup

• Be noted that some • All you need to do now


apps may not work is connect your phone
because of this so using a data cable.
toggle it on or off • Enable USB debugging
accordingly. on your phone.
• Now Android Studio will
detect your phone.

START 05/21/2025 10
Android
Studio
Project Structure

START 05/21/2025 11
Project Structure
Manifest Folder • It acts as an
• contains intermediator between
AndroidManifest.xml for
creating our android android OS and our
application. application.
• This file contains information
about our application such as
the Android version, metadata,
states package for Java file, and
other application components.

START 05/21/2025 12
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Sampleppt"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />


</intent-filter>
</activity>
</application>

</manifest>
Project Structure
Java Folder
• contains all the java and
Kotlin source code (.java)
files that we create during
the app development,
including other Test files.
• This is where we add
functions to our code.

START 05/21/2025 14
package com.example.sampleppt;

import android.os.Bundle;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
}
}
Project Structure

Resource (res) Folder


• is the most important
folder because it
contains all the non-code
sources like images, XML
layouts, and UI strings
for our android
application.

START 05/21/2025 16
Project Structure

drawable Folder
• It contains the different
types of images used
for the development of
the application.

START 05/21/2025 17
Project Structure

layout Folder
• contains all XML layout
files which we used to
define the user interface
of our application.
• It contains the
activity_main.xml file.

START 05/21/2025 18
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Project Structure

layout Folder
• This what you will see
once you open the
activity_main.xml
file.

START 05/21/2025 20
Split View
Code View
Design View
Project Structure

mipmap Folder
• contains launcher.xml
files to define icons
that are used to show
on the home screen.

START 05/21/2025 24
Project Structure
values Folder
• contains a number of XML
files like strings, dimensions,
colors, and style definitions.
• One of the most important
files is the strings.xml file
which contains the
resources.

START 05/21/2025 25
<resources>
<string
name="app_name">sampleppt</string>
</resources>
Project Structure
Gradle Scripts Folder
• Gradle means automated
build system and it
contains a number of files
that are used to define a
build configuration that
can be applied to all
modules in our application.

START 05/21/2025 27
Live Demo
Basic Input and Output

START 05/21/2025 28
Key Notes
TextView OnClick
• A basic event used
• A label used in an app.
commonly on buttons.
EditText Imports
• Where you input text • Like android.view.View;
and android.widget.*; is
Button important for us to access
• Where events are certain components in our
added app.

START 05/21/2025 29
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);

//Syntax for getting componentIDs


//varname = (componentType) findViewById(R.id.componentID);
tv1 = (TextView) findViewById(R.id.tv_display);
et1 = (EditText) findViewById(R.id.et_name);

ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main),
(v, insets) -> {
Insets systemBars =
insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right,
systemBars.bottom);
return insets;
});
}
Key Notes

<Button
android:id="@+id/btn_confirm"
android:layout_width="196dp"
android:layout_height="48dp"
android:layout_marginTop="20dp"
public void displayText(View view){ android:backgroundTint="#009688"
android:text="Confirm"
tv1.setText("Hello " + android:textSize="20sp"
et1.getText()); android:onClick="displayText"
} app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toBottomOf="@+id/tv_di
splay" />

START 05/21/2025 31
Any
Questions
?
As long as it is related to
the topic

START 05/21/2025 32

You might also like