[go: up one dir, main page]

0% found this document useful (0 votes)
12 views3 pages

Android Short Notes

The document provides an overview of Android, a mobile operating system developed by Google, detailing its features, directory structure, and essential components like the AndroidManifest.xml. It explains the organization of source files, resources, and UI elements, as well as event handling, logging, and intents for app communication. Additionally, it outlines the activity lifecycle phases that manage the state of an application.
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)
12 views3 pages

Android Short Notes

The document provides an overview of Android, a mobile operating system developed by Google, detailing its features, directory structure, and essential components like the AndroidManifest.xml. It explains the organization of source files, resources, and UI elements, as well as event handling, logging, and intents for app communication. Additionally, it outlines the activity lifecycle phases that manage the state of an application.
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/ 3

Android Intro

• Android: A mobile operating system developed by Google, based on Linux


kernel.

• Features: Open-source, customizable UI, vast app ecosystem.

Directory Structure
• Root Directory: Contains multiple folders like src, res, assets, libs.

• src: Source files for the app, typically in Java or Kotlin.

• res: Resources such as layouts, strings, images.

Manifest
• AndroidManifest.xml: Declares app components, permissions, and hardware
features.

• Components: Activities, services, broadcast receivers, content providers.

Java Folder
• Location: src/main/java

• Contains: Java/Kotlin source code for the application.

Res Folder
• Location: src/main/res

• Contains: Resources such as layouts, drawables, mipmaps, values.

Drawable
• Purpose: Contains bitmap images, XML graphics (e.g., shapes, selectors).

• Location: res/drawable

Mipmap
• Purpose: Stores app launcher icons in various densities.

• Location: res/mipmap

Layout
• Purpose: XML files defining the app's UI layout.

• Location: res/layout
Values
• Purpose: XML files for resources like strings, colors, dimensions.

• Location: res/values

XML
• Extensible Markup Language: Used for defining UI layouts and resources in
Android.

• Structure: Hierarchical with nested tags.

Linear Layout
• Type: Layout that arranges children in a single column or row.

• Attributes: orientation, gravity, weight

Relative Layout
• Type: Layout that arranges children relative to each other.

• Attributes: alignParentTop, alignParentBottom, centerInParent

XML Java Communication


• Method: Using findViewById() to link XML elements with Java/Kotlin code.

• Example: TextView myTextView = findViewById(R.id.my_text_view);

UI Controls
• EditText: Input field for text.

• TextView: Displays text.

• Button: Clickable button.

• PasswordBox: EditText with inputType="textPassword"

Event Handling
• Purpose: Managing user interactions.

• Example: Setting an OnClickListener for buttons.

Toast
• Purpose: Displays short messages to the user.

• Usage: Toast.makeText(context, "Message", Toast.LENGTH_SHORT).show();


Log
• Purpose: Logging information for debugging.

• Types: Log.d(), Log.e(), Log.i(), Log.w(), Log.v()

System.out.println
• Purpose: Print output to the console (less commonly used in Android).

Logcat
• Tool: Used for viewing system messages, including stack traces when an error
occurs.

Multi Button Clicks


• Method: Implement multiple OnClickListener or use a single listener with a
switch statement.

Intent
• Purpose: Messaging object to request an action from another app component.

• Types: Implicit, explicit.

Implicit Intent
• Purpose: Requests an action without specifying the component.

• Example: Intent intent = new Intent(Intent.ACTION_VIEW,


Uri.parse("http://www.example.com"));

Explicit Intent
• Purpose: Specifies the exact component to start.

• Example: Intent intent = new Intent(this, TargetActivity.class);

Lifecycle
• Phases: onCreate(), onStart(), onResume(), onPause(), onStop(), onDestroy()

• Purpose: Manages the state of an activity.

You might also like