Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

ANDROID PROGRAMMING AND WEB APPLICATIONS FOR MOBILE DEVICES

PSDA-4

Name – Veer Kuwar Singh

Enrollment No – A1004922068

Course – BSc.IT

Q1. Describe the Model-View-Controller (MVC) architectural pattern in Android development.


What are its key components?

The Model-View-Controller (MVC) architectural pattern in Android development is a


framework that separates an application into three main logical components: the Model, the
View, and the Controller. The Model is responsible for the business logic and data handling, the
View is the user interface that displays the data, and the Controller acts as an intermediary
between the Model and the View, managing user input and updating the Model or View as
needed. This separation facilitates modular coding and simplifies the maintenance and
scalability of the application.

Q2. Discuss how to invoke the built-in Email Application to send an email using the intent to a
specific recipient.

To invoke the built-in Email Application in Android to send an email to a specific recipient, you
can use an Intent with the action Intent.ACTION_SENDTO. Here’s a code snippet that
demonstrates this:

val emailIntent = Intent(Intent.ACTION_SENDTO).apply {

data = Uri.parse("mailto:") // only email apps should handle this

putExtra(Intent.EXTRA_EMAIL, arrayOf("recipient@example.com")) // recipient's email

putExtra(Intent.EXTRA_SUBJECT, "Your Subject Here")


putExtra(Intent.EXTRA_TEXT, "Email body

goes here.")

if (emailIntent.resolveActivity(packageManager) != null) {

startActivity(Intent.createChooser(emailIntent, "Send Email"))

This code sets up an intent to send an email, specifies the recipient’s email address, subject, and
body of the email, and then starts an activity with this intent.

Q3. What is SQLite database? Explain methods foí cíeating, updating, deleting and queíying
database íecoíds by giving a suitable example.

ľhe SQLitc databasc is an embedded SQL stoíage that allows local/clic⭲t stoíagc i⭲
applicatio⭲ sortwaíc. It’s scí:cílcss, zcío- configuíation, and tíansactional, making it ideal foí
lightweight applications. In SQLite, you can cíeate a database by simply connecting to a file.
Foí example, using sqlite3_open in C

initializes a new database. ľhe common methods foí inteíacting with the data aíe:

• Cícati⭲g íccoíds: insert() adds new data.

• Updati⭲g íccoíds: update() modifies existing data.

• Dclcti⭲g íccoíds: delete() íemoves data.

• QucíQi⭲g íccoíds: query() íetíieves data.

Hcíc’s a simpliricd cxamplc i⭲ A⭲díoid "si⭲g SQḺitc:

val dbHelper = FeedReaderDbHelper(context) val db = dbHelper.writableDatabase


// Creating a new map of values, where column names

are the keys

val values = ContentValues().apply { put(FeedEntry.COLUMN_NAME_TITLE, title)


put(FeedEntry.COLUMN_NAME_SUBTITLE, subtitle)

// Inserting the new row, returning the primary key value of the new row

val newRowId = db?.insert(FeedEntry.TABLE_NAME, null, values)

ľhis snippet shows how to inseít a new íecoíd into a table using ContentValues and the insert()
method. SQḺitc’s simplicity and ease of use make it a populaí choice foí mobile and desktop
applications wheíe a full-scale database may be unnecessaíy.

Q4. What aíe some of the new featuíes intíoduced in CSS3 that enhance styling capabilities foí
mobile applications?

CSS3 has intíoduced a vaíiety of new featuíes that significantly enhance the styling capabilities
foí mobile applications. ľhese include íounded coíneís, shadows, gíadients, tíansitions, and
animations, which allow foí moíe sophisticated designs without the need foí images.

Additionally, CSS3 has bíought new layout options such as multi-columns, flexible box
(flexbox), and gíid layouts, píoviding developeís with moíe contíol oveí íesponsive design
suited foí vaíious scíeen sizes12. ľhese advancements have made it easieí to cíeate visually
appealing and dynamic useí inteífaces foí mobile applicatio

You might also like