0% found this document useful (0 votes)
4 views21 pages

Activity 2025

The document provides an overview of Android as a mobile operating system, detailing its components such as MainActivity.java and AndroidManifest.xml. It explains the concepts of intents, including implicit and explicit intents, and provides instructions on creating layouts and coding for Android applications. The document is intended for a training course led by C.V. Nisha Angeline at Thiagarajar College of Engineering, scheduled from July 1 to July 12, 2024.

Uploaded by

student -1
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)
4 views21 pages

Activity 2025

The document provides an overview of Android as a mobile operating system, detailing its components such as MainActivity.java and AndroidManifest.xml. It explains the concepts of intents, including implicit and explicit intents, and provides instructions on creating layouts and coding for Android applications. The document is intended for a training course led by C.V. Nisha Angeline at Thiagarajar College of Engineering, scheduled from July 1 to July 12, 2024.

Uploaded by

student -1
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/ 21

TCE 1st July – 12th July, 2024

Components –
Activity

C.V.Nisha Angeline
Assistant Professor,IT

Thiagarajar College of
1
Engineering ,Madurai
Android
Android is a mobile operating system based on

the Linux kernel and designed primarily for

touchscreen mobile devices such as

smartphones and tablet

06/23/2025 C.V.Nisha Angeline,APIT,TCE 2


Components
MainActivity.java
of an Mobile
application
AndroidManifest.x
activity_main.xml ml

06/23/2025 C.V.Nisha Angeline,APIT,TCE 3


The Process

13
06/23/2025 C.V.Nisha Angeline,APIT,TCE 4
New Terms!!!
• SDK
• ADB
• Gradle
• DEX File
• APK
• Device Manager - Emulator

13
06/23/2025 C.V.Nisha Angeline,APIT,TCE 5
activity_main.xml
Layouts
Linear Layout
• Horizontal
• Vertical

Relative Layout

Frame Layout

Table Layout

Constraint Layout

05
06/23/2025 C.V.Nisha Angeline,APIT,TCE 6
activity_main.xml
view

05
06/23/2025 C.V.Nisha Angeline,APIT,TCE 7
Android Manifest
Intent
Activi
Targe ty
label t API
Icon

06/23/2025 C.V.Nisha Angeline,APIT,TCE 8


Activity-
MainActivity.jav
a
An activity is a single, focused thing
that the user can do.
Almost all activities interact with the
user.
The Activity class takes care of
creating a window for you in which you
can place your UI with
setContentView(View). .

06/23/2025 C.V.Nisha Angeline,APIT,TCE 9


06/23/2025 C.V.Nisha Angeline,APIT,TCE 10
Intent

• Intents are asynchronous messages which allow application components to request

functionality from other Android components.

• Intents allow you to interact with components from the same applications as well as with

components contributed by other applications.

• For example, an activity can start an external activity for taking a picture.

06/23/2025 C.V.Nisha Angeline,APIT,TCE 11


Types of
Intents
• Implicit Intent

• Explicit Intent

06/23/2025 C.V.Nisha Angeline,APIT,TCE 12


Implicit Intent
• Implicit intents specify the action which should be performed and
optionally data which provides content for the action.
• If an implicit intent is sent to the Android system, it searches for all
components which are registered for the specific action and the
fitting data type.
• If only one component is found, Android starts this component
directly.
• If several components are identified by the Android system, the user
will get a selection dialog and can decide which component should
be used for the intent.

06/23/2025 C.V.Nisha Angeline,APIT,TCE 13


C.V.Nisha Angeline,APIT,TCE

What are we going to create?

06/23/2025 14
Lets Start!!
• In your activity_main.xml

• Create a Relative Layout

• Add Edit Text Widget

• Add a Button – Name it Visit

06/23/2025 C.V.Nisha Angeline,APIT,TCE 15


How to create
Implicit Intent
• Create a button Object
• val button: Button = findViewById(R.id.Button)

• Set a listener to the button


• Button.setOnClickListener

• Create an Intent Object


• intent= Intent(Intent.ACTION_VIEW)
• Set Data
• intent.setData(Uri.parse("http://www.google.com"))

• Start the Intent


• startActivity(intent)

06/23/2025 C.V.Nisha Angeline,APIT,TCE 16


Explicit Intent
• An application can define the target component directly in the intent
(explicit intent)
• Explicit intents are typically used within an application.

06/23/2025 C.V.Nisha Angeline,APIT,TCE 17


Now Let’s try
to code this!!

06/23/2025 C.V.Nisha Angeline,APIT,TCE 18


Lets Start!!
• You tell me the steps

06/23/2025 C.V.Nisha Angeline,APIT,TCE 19


How to create
Explicit Intent
MainActivity
• intent= Intent(this,MainActivity2::class.java)
• intent.putExtra("val",sum)
• startActivity(intent)

MainActivity2
• val score =intent.getIntExtra("val",0)

06/23/2025 C.V.Nisha Angeline,APIT,TCE 20


Thank You
Ema Mobil
il e
[email protected] 9842175
694

C.V.Nisha Angeline,APIT,TCE 21

You might also like