0% found this document useful (0 votes)
13 views6 pages

Android Programming Complete Notes Questions Practicals

The document provides a comprehensive overview of Android programming, structured into five units covering Android basics, views and layouts, layouts with ListView and SQLite, advanced UI components, and activities, intents, and fragments. Each unit includes important exam questions, practical programs, and viva questions to aid in understanding the concepts. Key topics include Android architecture, UI components, database management, and the lifecycle of activities.

Uploaded by

Harshit Khurana
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)
13 views6 pages

Android Programming Complete Notes Questions Practicals

The document provides a comprehensive overview of Android programming, structured into five units covering Android basics, views and layouts, layouts with ListView and SQLite, advanced UI components, and activities, intents, and fragments. Each unit includes important exam questions, practical programs, and viva questions to aid in understanding the concepts. Key topics include Android architecture, UI components, database management, and the lifecycle of activities.

Uploaded by

Harshit Khurana
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

ANDROID PROGRAMMING

Unit-wise Notes, Important Exam Questions, Practical Programs & Viva Questions

As per MGSU Bikaner Syllabus


UNIT I – ANDROID BASICS

Android is an open-source mobile operating system developed by Google. It is based on Linux


kernel and used to develop mobile applications.

Android Architecture consists of Linux Kernel, Native Libraries, Android Runtime (ART), Application
Framework and Applications.

Android Studio is the official IDE. Android SDK contains required tools. AVD is used to test apps
virtually.

Package structure includes Java folder, res folder, Gradle files and [Link].

Important Exam Questions – Unit I

1. Explain Android Architecture with diagram.


2. What is Android SDK and AVD?
3. Explain Android Studio features.
4. Explain Android application package structure.

Practical Programs – Unit I

1. Install Android Studio and create your first Android application.


2. Run application on emulator.

Viva Questions – Unit I

What is Android? What is AVD? What is APK?


UNIT II – VIEWS AND LAYOUTS

View is a UI component used to create user interface. Layout is a container used to arrange views.

Common views are TextView, EditText, Button, ImageView, RadioButton and CheckBox.

Toast is a short message popup. Notification is used to alert users.

Important Exam Questions – Unit II

1. What is View and Layout?


2. Explain TextView and EditText.
3. Difference between RadioButton and CheckBox.
4. Explain Toast with example.

Practical Programs – Unit II

1. Design a login form using EditText and Button.


2. Display Toast message on button click.

Viva Questions – Unit II

What is Layout? What is Toast? What is XML?


UNIT III – LAYOUTS, LISTVIEW AND SQLITE

LinearLayout arranges views vertically or horizontally. RelativeLayout arranges views relative to


other views.

Adapter connects data source to ListView or GridView.

SQLite is a lightweight database used to store data locally in Android.

Important Exam Questions – Unit III

1. Explain LinearLayout and RelativeLayout.


2. What is Adapter?
3. Explain SQLite database and CRUD operations.

Practical Programs – Unit III

1. Create ListView using ArrayAdapter.


2. Create SQLite database and insert records.

Viva Questions – Unit III

What is SQLite? What is Adapter? What is ListView?


UNIT IV – ADVANCED UI COMPONENTS

Spinner is a dropdown list. AutoCompleteTextView provides suggestions while typing.

Margin is space outside view and Padding is space inside view.

RadioGroup allows only one RadioButton selection.

Important Exam Questions – Unit IV

1. Explain Spinner with example.


2. Difference between Margin and Padding.
3. Explain Android core components.

Practical Programs – Unit IV

1. Create Spinner using ArrayAdapter.


2. Create AutoCompleteTextView.

Viva Questions – Unit IV

What is Spinner? What is Padding?


UNIT V – ACTIVITY, INTENT AND FRAGMENTS

Activity represents a single screen. Activity lifecycle includes onCreate, onStart, onResume,
onPause, onStop and onDestroy.

Intent is used to communicate between components. Fragments are reusable UI components.

Android allows sending SMS, Email and making phone calls using intents.

Important Exam Questions – Unit V

1. Explain Activity lifecycle.


2. What is Intent? Types of Intent.
3. Explain Fragments.

Practical Programs – Unit V

1. Create two activities and pass data using Intent.


2. Create fragment based application.

Viva Questions – Unit V

What is Activity? What is Intent? What is Fragment?

Common questions

Powered by AI

In Android, Intents are used for facilitating communication between components. They carry messages and requests for an action to be performed, and are crucial for starting activities, services, or broadcasting messages within and between applications. There are two types of intents: explicit and implicit. Explicit intents specify the exact component to start by providing its complete class name, used often within an application to start a new activity or service known by its package name, such as switching from a MainActivity to a DetailActivity. Implicit intents do not name a specific component; instead, they declare a general action to perform, allowing the system to decide which component to start based on the data and the action specified. For example, an implicit intent might be used to open a URL in a web browser or to pick a contact from the user's contacts list by allowing any app installed on the device to handle the action .

Fragments are reusable components in Android that represent a portion of user interface within an activity. They enable developers to build modular applications, as fragments can be combined within a single activity or reused across different activities. This modularity supports flexible UI designs, such as adapting to different screen sizes between phones and tablets with the same code. Fragments handle their own lifecycle, have separate layouts, and respond to user inputs independently, allowing dynamic UI management and transaction between fragments at runtime. A use-case scenario includes a news application, where simultaneous displays of a list of articles and a detailed view of one article are needed. Fragments allow the list and the detail view to be independent, easily displaying one or both based on the device's screen size and orientation .

The Android Activity lifecycle is crucial for effective resource management, as it dictates how activities are created, paused, resumed, and destroyed. This lifecycle includes several states: onCreate, onStart, onResume, onPause, onStop, and onDestroy. Effective management of these states ensures that resources, such as memory and CPU time, are used efficiently. For example, onPause is used to save user data and release system resources that are not needed when the activity is not visible, such as stopping animations or intensive processing. The onStop and onDestroy states ensure that resources are cleaned up completely, preventing memory leaks. Understanding these transitions helps developers maintain an optimal user experience by avoiding unnecessary background tasks when an activity is not at the forefront, thus prolonging battery life and improving application performance .

Android Studio is the official Integrated Development Environment (IDE) for Android application development, developed by Google. It is based on IntelliJ IDEA and provides a comprehensive suite of features tailored for Android development. Key features include a robust code editor with syntax highlighting, intelligent code completion, and refactoring tools. The integration with Gradle allows for flexible and automated builds. Android Studio also includes a rich layout editor that supports drag-and-drop functionality and a real-time preview of XML layouts. It provides deep integration with emulators for testing apps and debugging tools for inspecting app performance and network activity. These functionalities collectively offer a highly productive and efficient development platform for Android applications .

The Adapter in Android acts as a bridge between a data source and the ListView or GridView, converting data into list items. Adapters manage the data and provide an access point to the data items. Common types of Adapters include ArrayAdapter, which is used for managing arrays and converting them into Views, and CursorAdapter, used for handling database queries where each row in the database is converted into a View in the list. Adapters play a crucial role in optimizing memory use by recycling Views instead of creating a new one for each data item, especially useful in lists containing a large number of items .

SQLite in Android applications serves as a lightweight, relational database management system, embedded in the application to store data locally. It is beneficial for managing small to medium-sized data that does not require a network connection to access. The basic CRUD operations supported by SQLite include Create, to add new rows to tables; Read, to query and retrieve data; Update, to modify existing records; and Delete, to remove records from tables. These operations are essential for applications that require persistent data storage and retrieval. SQLite's simplicity and self-contained nature make it an attractive option for local data storage in Android apps .

The primary components of the Android architecture are the Linux Kernel, Native Libraries, Android Runtime (ART), Application Framework, and Applications. The Linux Kernel acts as the hardware abstraction layer, providing device drivers for various components such as display, camera, and keypad, and managing power, memory, and processes. Native Libraries are written in C/C++ and provide a foundation for Android by offering functionalities vital for application development, including graphics, media, and database support. Android Runtime (ART) replaces the older Dalvik runtime, optimizing the execution of applications and managing their lifecycle. The Application Framework provides higher-level services to applications in the form of Java classes, such as activity management, resource management, and content providers, thus facilitating the development of reusable components. Applications are developed in Java and utilize the ART and Application Framework for execution and interaction with the device hardware and system services .

In Android layouts, Margin refers to the space outside a view, essentially the buffer area between the view's border and the boundaries of its container or neighboring views. Padding, on the other hand, is the space inside the view's border, between the content and the view's edge. These properties affect user interface design by influencing how UI elements are spaced within their layouts, contributing to a clean and structured appearance. Proper use of Margin can prevent overlaps between components and ensure visually distinct separations. Padding can enhance readability and usability by ensuring that text and other content do not touch the view's edges, which might otherwise create a cluttered or hard-to-read interface .

RadioButtons and CheckBoxes are both used to allow user selections. A RadioButton is typically used when you have multiple options, but only one can be selected at any given time within a specific group. It is often used in scenarios where users must choose exactly one option from a set, such as selecting a gender in a form (Male/Female/Other). In contrast, a CheckBox allows multiple selections from a group of options and is used when user decisions are not mutually exclusive, such as choosing interests in a survey where users can select multiple interests that apply to them. RadioButtons are usually grouped in a RadioGroup to automatically handle the selection logic. CheckBoxes, however, work independently .

An AVD, or Android Virtual Device, is an emulator configuration represented by a file that mimics a physical Android device's hardware and software capabilities. It is crucial for application testing because it allows developers to run and test their applications in a controlled environment that simulates different device scenarios, including varying screen sizes, resolutions, and Android operating system versions. This helps in identifying issues and ensuring that applications function smoothly on various devices without the need for physical access to every type of device. Hence, AVDs are essential for initial testing phases, coverage of edge cases, and efficient bug detection in the Android development process .

You might also like