0% found this document useful (0 votes)
14 views24 pages

CAT II Question Bank

The document provides an overview of various concepts related to Android development, including AVD, notifications, views, web views, SQLite, shared preferences, Toast, content providers, location-based services, hybrid applications, breakpoints, intent objects, table layouts, menus, and IDEs. It also covers front-end development, user interface creation, SMS messaging, and consuming web services. Key mobile application services are briefly mentioned at the end.

Uploaded by

nided12678
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)
14 views24 pages

CAT II Question Bank

The document provides an overview of various concepts related to Android development, including AVD, notifications, views, web views, SQLite, shared preferences, Toast, content providers, location-based services, hybrid applications, breakpoints, intent objects, table layouts, menus, and IDEs. It also covers front-end development, user interface creation, SMS messaging, and consuming web services. Key mobile application services are briefly mentioned at the end.

Uploaded by

nided12678
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/ 24

1. What is meant by AVD?

An Android Virtual Device (AVD) is a configuration that defines the characteristics of


an Android phone, tablet, Wear OS, Android TV, or Automotive OS device that users
want to simulate in the Android Emulator.
It contains a hardware profile, system image, storage area, skin, and other properties.
2. Define notification.
Notification is a kind of message, alert, or status of an application (probably running in
the background) that is visible or available in the Android’s UI elements.
This application could be running in the background but not in use by the user.
The purpose of a notification is to notify the user about a process that was initiated in the
application either by the user or the system
3. Define view and viewgroup
View is a basic building block of UI (User Interface) in android.
It is a small rectangular box that responds to user inputs. Eg: EditText, Button,
CheckBox, etc. View refers to the android.view.View class, which is the super class for
all the GUI components like Text View, ImageView and Button etc.
A ViewGroup is a special view that can contain other views. The ViewGroup is the base
class for Layouts in android, like Linear Layout, Relative Layout, Frame Layout etc.
4. What do you mean by web view?
Android WebView is used to display web page in android.
The web page can be loaded from same application or URL.
It is used to display online content in android activity.
Android WebView uses webkit engine to display web page.
The android.webkit.WebView is the subclass of AbsoluteLayout class.
The loadUrl() and loadData() methods of Android WebView class are used to load and
display web page.
5. What are the three views used to display pictures?
a. ImageView-Class used to display an image file in application
b.Image Switcher- is an element of transition widget which helps to add transitions on the
images
c.Grid view- a viewgroup that display items in two dimensional scrolling grid(rows and
columns()
6. How do you create and insert data into a table in SQLite?
mydatabase.execSQL("CREATE TABLE IF NOT EXISTS IIIBCA(Username
VARCHAR,Password VARCHAR);");
mydatabase.execSQL("INSERT INTO IIIBCA VALUES('admin','admin');");
7. What do you mean by shared preferences?
Android provides the SharedPreferences object to help to save simple application data.
Using the SharedPreferences object, can save the data through the use of key/value pairs
— specify a key for the data to save then both it and its value will be saved
automatically to an XML file.
The shared Preferences class provides APIs for reading, writing, and managing this data.
8. What is Toast in Android?
A Toast is a feedback message. It takes a very little space for displaying while the overall
activity is interactive and visible to the user. It disappears after a few seconds. It
disappears automatically. If the user wants a permanently visible message,
a Notification can be used.
9. Define content provider
Content Providers are a very important component that serves the purpose of a
relational database to store the data of applications.

The role of the content provider in the android system is like a central repository in
which data of the applications are stored, and it facilitates other applications to securely
access and modifies that data based on the user requirements.

10. What is Location based service?


A location-based service is a software service for mobile device applications that
requires knowledge about where the mobile device is geographically located. The
application collects geodata, which is data gathered in Real Time using one or more
location tracking technologies. Location-based services integrate data from various
resources, including Global Positioning System (GPS) satellites, cellular tower pings and
short-range positioning beacons, to provide services based on the user's geographical
location.

11. Define: ―Hybrid Application‖.


Hybrid applications combine the features of both native and web apps. They can be
accessed via a web browser and downloaded from app stores. They are written in
HTML5 and JavaScript, like web apps.
12. What is the use of breakpoints?
Breakpoints are a mechanism by which you can tell Android Studio to temporarily
pause execution of your code, which allows you to examine the condition of your
application.

This means that you can check on the values of variables in your application while you
are debugging it. Also, you can check whether certain lines of code are being executed
as expected – or at all.
13. What is the purpose of intent object?
Intent is used to move from screen to screen.Intent describes what an application does.
The action and the data to act upon are the two most important parts of the
intent.Typical values for action are MAIN,VIEW,PICK,EDIT,etc
The data is expressed as a Unifrom Resource Indicator(URI)
Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://www.w3schools.com/"));
startActivity(intent);
14. What is table layout?
The TableLayout Layout groups views into rows and columns. You use the element
to designate a row in the table. Each row can contain one or more views. Each view you
place within a row forms a cell. The width of each column is determined by the largest
width of each cell in that column.
15. How can the viewgroup be classified?
ViewGroups are classified into
1. Basic Views
2. Picker Views
3. List Views
4. Specialized Fragments
16. What are the differences between the options menu and context menu?
Android Options Menu is a primary collection of menu items in an android
application and is useful for actions that have a global impact on the searching
application.

Android Context Menu is a floating menu that only appears when the user clicks for
a long time on an element and is useful for elements that affect the selected content or
context frame.
17. What do you mean by content providers?
Content Providers are a very important component that serves the purpose of a
relational database to store the data of applications.

The role of the content provider in the android system is like a central repository in
which data of the applications are stored, and it facilitates other applications to
securely access and modifies that data based on the user requirements.

18. How do you create a database in SQLite?


In order to create a database just need to call the method openOrCreateDatabase with
database name and mode as a parameter.
It returns an instance of SQLite database
Syntax
SQLiteDatabase mydatabase = openOrCreateDatabase("database
name",MODE_PRIVATE,null{flags});
19. What are the specialized fragments?
Specialized fragment is the part of Activity which represents a portion of User
Interface(UI) on the screen.

It is the modular section of the android activity that is very helpful in creating UI
designs that are flexible in nature and auto-adjustable based on the device screen size

20. What is IDE?


An IDE, or integrated development environment, is a software application that helps
programmers develop software code more efficiently. IDEs combine common
developer tools into a single graphical user interface (GUI).
IDEs typically include:
 Source code editor
 Build automation
 Debugger

1. Summarize the mobile application front end.


Front-end Development
 is the development of the graphical user interface of a device using HTML, CSS,
and JavaScript
 Users can view and interact with that device
 it consists of text colors, styles, photos, graphs, tables, buttons, colors, navigation
menus etc.,
 Front end developers provide structure, appearance , behaviour and content of
everything that appears when the mobile apps are opened
 Key Focus Points are
o Responsiveness – must work on all type of devices
o Performance – should stable at all times

Front-end Languages
 The Languages used for front end development are
o HTML
o CSS
o JavaScript
 Provide the Good look and feel of the mobile app
 Front end development is depending on the frameworks such as Dart in flutter,
Javascript in React, Python in Django and so on
HTML

 HTML stands for Hyper Text Markup Language


 HTML is the standard markup language for creating Web pages
 HTML is used to create the architecture of the documentations
 The contents are structured in a specific way in the form of titles ,headings , sub
headings, basic text ,images etc.,
 HTML elements tell the browser how to display the content

CSS
 CSS stands for Cascading Style Sheets.
 It is the language for describing the presentation of Web pages, including colours,
layout, and fonts, thus making web pages presentable to the users.
 CSS is designed to make style sheets for the web.
 It is independent of HTML and can be used with any XML-based markup language.
o Cascading: Falling of Styles
o Style: Adding designs/Styling the HTML tags
o Sheets: Writing the style in different documents
 CSS handles the look and feel part of a web page.
 Using CSS, user can control the color of the text, the style of fonts, the spacing
between paragraphs, how columns are sized and laid out, what background images or
colors are used, layout designs, variations in display for different devices and screen
sizes as well as a variety of other effects.

JavaScript
o JavaScript is a lightweight, cross-platform, single-threaded, and interpreted
compiled programming language.
o It is also known as the scripting language for webpages.
o It is well-known for the development of web pages
o JavaScript is a weakly typed language (dynamically typed).
o JavaScript can be used for Client-side developments as well as Server-
side developments

2. Explain the steps to create user interface programmatically


This approach is useful if your UI needs to be dynamically generated during runtime. For
example, suppose you are building a cinema ticket reservation system and your
application displays the seats of each cinema using buttons. In this case, you need to
dynamically generate the UI based on the cinema selected by the user.
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.view.View;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Step 1: Create a root LinearLayout


LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL); // Set orientation to vertical
layout.setPadding(50, 50, 50, 50); // Optional: set padding around the layout

// Step 2: Create a TextView (to display a label)


TextView textView = new TextView(this);
textView.setText("Enter your name:"); // Set text for TextView
textView.setTextSize(18); // Set text size

// Step 3: Create an EditText (for user input)


EditText editText = new EditText(this);
editText.setHint("Type your name here"); // Set a hint for the EditText

// Step 4: Create a Button (to trigger an action)


Button button = new Button(this);
button.setText("Submit");

// Step 5: Set a click listener for the button


button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Get the text input from the EditText
String name = editText.getText().toString();
// Display a Toast message with the input
Toast.makeText(MainActivity.this, "Hello, " + name,
Toast.LENGTH_SHORT).show();
}
});

// Step 6: Add the views to the layout


layout.addView(textView); // Add TextView to the layout
layout.addView(editText); // Add EditText to the layout
layout.addView(button); // Add Button to the layout

// Step 7: Set the layout as the activity's content view


setContentView(layout); // This makes the layout visible on the screen
}
}
3. Outline the components of a screen in mobile.
 The basic unit of android application is the activity.
 A UI is defined in an xml file.
 During compilation, each element in the XML is compiled into equivalent Android
GUI class with attributes represented by methods.
 Every application is a combination of View and ViewGroup.
 an android application contains a large number of activities
 Can say each activity is one page of the application.
 Each activity contains multiple user interface components and those components are
the instances of the View and ViewGroup.
 All the elements in a layout are built using a hierarchy
of View and ViewGroup objects.

View

 A View is defined as the user interface which is used to create interactive UI


components such as TextView, ImageView, EditText, RadioButton, etc., and is
responsible for event handling and drawing.
 They are Generally Called Widgets.

ViewGroup
 act as a base class for layouts and layouts parameters that hold other Views or
ViewGroups and to define the layout properties.
 They are Generally Called layouts.
Types of layout
 There are many types of layout.
o Linear Layout
o Absolute Layout
o Table Layout
o Frame Layout
o Relative Layout

4. Explain how to send SMS messages programmatically.


 Sending a text SMS over the phone using the SMSManager class in an Android
application.
 SMSManager class manages operations like sending a text message, data message,
and multimedia messages (MMS).
 For sending a text message method sendTextMessage() is used
 for multimedia message sendMultimediaMessage()
 for data message sendDataMessage() method is used.

Function Description

sendTextMessage(String destinationAddress,
sendTextMessage() String scAddress, String text, PendingIntent sentIntent,
PendingIntent deliveryIntent, long messageId)

sendDataMessage(String destinationAddress,
sendDataMessage() String scAddress, short destinationPort, byte[] data,
PendingIntent sentIntent, PendingIntent deliveryIntent)
Function Description

sendMultimediaMessage(Context context,
sendMultimediaMessage() Uri contentUri, String locationUrl,
Bundle configOverrides, PendingIntent sentIntent

SmsManager API
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage("phoneNo", null, "sms message", null, null);
Built-in SMS application
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", "default content");
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
Note, both need SEND_SMS permission.
<uses-permission android:name="android.permission.SEND_SMS" />

5. Explain about consuming web services using HTTP.


One common way to communicate with the outside world is through HTTP.
Consuming a  HTTP is no stranger to most people; it is the protocol that drives much of the web’s
web service
means making a success.
request to a  Using the HTTP protocol, Programmers can perform a variety of tasks, such as
remote server
(API) to retrieve downloading web pages from a web server, downloading binary data, and more.
or send data.
It allows an  Downloading Binary Data - A common task 4ser need to perform is downloading
application to
interact with binary data from the web.
external services,
such as fetching  For example, 4ser might want to download an image from a server so that they can
weather updates, display it in their application.
user data, or
processing  Downloading Text Content – Users can also download plain-text content.
payments.
 For example, Users might want to access a web service that returns a string of random
quotes.
 Accessing Web Services Using the GET Method - Very often, need to download
XML files and parse the contents (a good example of this is consuming web services).
connect to a web service using the HTTP GET method.
 After the web service returns a result in XML, extract the relevant parts and display
its content using the Toast class
6. Explain the key mobile application services.
 Key services of Mobile App Development are classified into following types
1. Life Style Mobile Apps
2. Social Media Mobile Apps
3. Utility Mobile Apps
4. Games/Entertainment Mobile Apps
5. Productivity Mobile Apps
6. News/Information outlets Mobile Apps
1. Life Style Mobile Apps
 It is app run on daily basis for finding people’s daily life needs
Example Finding next new song, Finding New Restaurant
 They tracks their likes and dislikes
Example
o Google Fit – Fitness
o Music – Spotify
o Travel – Uber,Ola
o Food – Swiggy,Zomato
2. Social Media Mobile Apps
 It allows the people to socialize and share information and feelings

Example Facebook, Instagram

3. Utility Mobile Apps


 Pre installed in the device and serve a single function i.e for particular purpose
Examples Remainder, Flashlight, Weather,Calculator
4. Games/Entertainment Mobile Apps
 Provides challenge and are addictive in nature
 Frequency and length of play is high
Examples Angry Birds, Subway Surfer

5. Productivity Mobile Apps


Helps the users to accomplish the task quickly and efficiently, making taks easier and fun
Examples Docs, Sheets, Evernote
7. Explain the steps for listening for UI notifications
 Identify the UI Element or Event
 Define UI elements in XML.
<Button android:id="@+id/submitButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit" />
 Use findViewById to get references to the UI components.
 Attach event listeners using methods like setOnClickListener,
addTextChangedListener, etc.
 Define the callback function to handle the event.
Button submitButton = findViewById(R.id.submitButton);
submitButton.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) { // Handle the button click event
Toast.makeText(getApplicationContext(), "Button clicked!",
Toast.LENGTH_SHORT).show(); } });

8. Outline the use of list views to display long lists.


Android ListView is a view which groups several items and display them in vertical
scrollable list.

The list items are automatically inserted to the list using an Adapter that pulls content
from a source such as an array or database.

ListView Attributes
 android:id
This is the ID which uniquely identifies the layout.
 android:divider
This is drawable or color to draw between list items.
 android:dividerHeight
This specifies height of the divider. This could be in px, dp, sp, in, or mm.
 android:entries
Specifies the reference to an array resource that will populate the ListView.
 android:footerDividersEnabled
When set to false, the ListView will not draw the divider before each footer view. The
default value is true.
 android:headerDividersEnabled
When set to false, the ListView will not draw the divider after each header view. The
default value is true.

ArrayAdapter adapter = new ArrayAdapter<String>(this,R.layout.ListView,StringArray);


ListView listView = (ListView) findViewById(R.id.listview);
listView.setAdapter(adapter);

9. Explain the need of persisting data to files.


Persisting data to files in Android is essential for the following reasons:
 Data Persistence Across App Sessions
When an Android app is closed or the device is restarted, any data that has not been
Persisting data to persisted (saved to a file or database) will be lost. Persisting data ensures that
files means information is retained even when the app is not running. For example, user
saving data to a
preferences, app settings, or saved content should be stored in a file so that they can
file on a device's
storage so it be accessed later.
remains  Efficient Storage Management
available even Not all data needs to be stored in a database or remotely. Some apps need to store
after the small amounts of data locally, such as configurations, logs, or cache files. File storage
application is can be more lightweight and appropriate for these cases compared to using more
closed or the
system restarts. complex storage mechanisms like SQLite databases or network-based storage.
This ensures  Offline Functionality
long-term Storing data in files allows Android apps to function offline. For instance, if a user
storage of enters data or interacts with the app while disconnected from the internet, that data
information can be saved in files and later synchronized with the server once the network
connection is restored. This is crucial for apps that need to work in environments with
intermittent or no internet connectivity.
 Speed and Performance
Accessing data from files can be faster for smaller datasets compared to querying a
database. For some apps, especially those with a small amount of data that doesn’t
require relational queries, writing and reading from files can offer better performance.
 User Customizations and Preferences
Many apps allow users to set preferences (e.g., language, theme, or notification
settings). These preferences can be saved in files (using key-value storage methods
like SharedPreferences or files in internal storage) and loaded when the app restarts.
This provides a personalized experience for the user.
 Backup and Restore
By persisting data in files, users can more easily back up their app data. For instance,
some apps offer backup options where users can save files (such as game progress or
user data) on the device or cloud storage. This allows for data restoration in case of
device replacement or factory reset.
 Inter-Process Communication
In some cases, multiple processes or apps need to share data. Files can be used as a
medium for sharing data between apps or background services, especially for
lightweight and simple data.
 Security and Encryption
Sensitive data can be saved to files with encryption to ensure that unauthorized parties
cannot access it. For example, Android allows developers to store encrypted data in
files, providing an additional layer of security for sensitive user information like
passwords or personal data.
 Data Caching
Frequently accessed data can be cached in files to improve the app's speed and reduce
unnecessary network requests or database queries. This is commonly done with
images, JSON data, or web content.
 Logging and Debugging
Developers often use file storage to log information about app performance, errors, or
user activity. These logs can be used for debugging and monitoring the app's
behavior, especially in production environments.

10. Summarize the steps to create your own content providers.


A Content  Create a class in the same directory where the that MainActivity file resides and
Provider in
Android is a this class must extend the ContentProvider base class.
component
that manages  To access the content, define a content provider URI address.
access to a
 Create a database to store the application data.
structured set
of data and  Implement the six abstract methods of ContentProvider class.
allows sharing
data between  Register the content provider in AndroidManifest.xml file using <provider> tag.
different
applications
securely. It
acts as an Abstract
interface for
Method Description
accessing
data stored in
databases,
files, or other A method that accepts arguments and fetches the data from
persistent query() the desired table. Data is retired as a cursor object.
storage

To insert a new row in the database of the content provider. It returns


insert() the content URI of the inserted row.

update() This method is used to update the fields of an existing row. It returns
Abstract
Method Description

the number of rows updated.

This method is used to delete the existing rows. It returns the number
delete() of rows deleted.

This method returns the Multipurpose Internet Mail


getType() Extension(MIME) type of data to the given Content URI.

As the content provider is created, the android system calls this


onCreate() method immediately to initialise the provider.

1. Explain the need of utilizing the action bar in android


ActionBar is the element present at the top of the activity screen.
It is a salient feature of a mobile application that has a consistent presence over all its
activities.
It provides a visual structure to the app and contains some of the frequently used
elements for the users.
Android ActionBar was launched by Google in 2013 with the release of Android
3.0(API 11).
Before that, the name of this top visual element was AppBar.
AppBar contains only the name of the application or current activity.
It was not very much useful for the users and developers have negligible option to
customize it.
Every android app contains an ActionBar by default.
This pre-included ActionBar display title for the current activity that is managed by
the AndroidManifest.xml file.
 The string value of the application’s title is provided
by @string/app_name resource present under the application nodes.

Components of ActionBar are:


 App Icon: Display the branding logo/icon of the application.
 View Controls: Section that displays the name of the application or current activity.
Developers can also include spinner or tabbed navigation for switching between
views.
 Action Button: Contains some important actions/elements of the app that may be
required to the users frequently.
 Action Overflow: Include other actions that will be displayed as a menu.
Advantages of ActionBar
 Provides a customized area to design the identity of an app
 Specify the location of the user in the app by displaying the title of the current
Activity.
 Provides access to important and frequently used actions
 Support tabs and a drop-down list for view switching and navigation.

2. Explain the steps to create and use of database in android
Creating and using database

 SQLite is a opensource SQL database that stores data to a text file on a device.
 Android comes in with built in SQLite database implementation.
 SQLite supports all the relational database features.
 In order to access this database, don't need to establish any kind of connections for it
like JDBC,ODBC e.t.c
 Database - Package
 The main package is android.database.sqlite that contains the classes to manage
the databases
 Database - Creation
o In order to create a database just need to call the method
openOrCreateDatabase with database name and mode as a parameter.
o It returns an instance of SQLite database

Syntax (String,

SQLiteDatabase mydatabase = openOrCreateDatabase("database


name",MODE_PRIVATE,null{flags});
 Database - Insertion
o can create table or insert data into table using execSQL method defined in
SQLiteDatabase class.

mydatabase.execSQL("CREATE TABLE IF NOT EXISTS IIIBCA(Username


VARCHAR,Password VARCHAR);");
mydatabase.execSQL("INSERT INTO IIIBCA VALUES('admin','admin');");
 Database - Fetching
o can retrieve anything from database using an object of the Cursor class.
o will call a method of this class called rawQuery
o it will return a resultset with the cursor pointing to the table.
o can move the cursor forward and retrieve the data.

Cursor resultSet = mydatbase.rawQuery("Select * from


IIIBCA",null);
resultSet.moveToFirst();
String username = resultSet.getString(0);
String password = resultSet.getString(1);

Method & Description

getColumnCount()
This method return the total number of columns of the table.

getColumnIndex(String columnName)
This method returns the index number of a column by specifying
the name of the column

getColumnName(int columnIndex)
This method returns the name of the column by specifying the
index of the column

getColumnNames()
This method returns the array of all the column names of the table.

getCount()
This method returns the total number of rows in the cursor

getPosition()
This method returns the current position of the cursor in the table

isClosed()
This method returns true if the cursor is closed and return false
otherwise

3. Explain how to perform repeated tasks in a service


To perform some repeated tasks in a service. For example, an alarm clock service that runs
persistently in the background. In this case, the service might need to periodically execute
some code to check whether a prescheduled time has been reached so that an alarm can be
sounded. To execute a block of code to be executed at a regular time interval, the Timer class
is used within the service. A Service in a mobile app (Android) is a background process
that performs tasks without a user interface. It runs in the
background even when the app is not actively in use.

Create a Timer object and call its scheduleAtFixedRate() method inside the
doSomethingRepeatedly() method that you have defined:
private void doSomethingRepeatedly() {
timer.scheduleAtFixedRate( new TimerTask() {
public void run() {
Log.d("MyService", String.valueOf(++counter));
}
}, 0, UPDATE_INTERVAL);
}
Pass an instance of the TimerTask class to the scheduleAtFixedRate() method so that you
can repeatedly execute the block of code within the run() method. The second parameter to
the scheduleAtFixedRate() method specifies the amount of time, in milliseconds, before first
execution. The third parameter specifies the amount of time, in milliseconds, between
subsequent executions.
In the preceding example, you essentially print the value of the counter every second (1,000
milliseconds). The service repeatedly prints the value of counter until the service is
terminated:
@Override
public void onDestroy() {
super.onDestroy();

if (timer != null){
timer.cancel();
}
Toast.makeText(this, "Service Destroyed", Toast.LENGTH_LONG).show();
}
For the scheduleAtFixedRate() method, your code is executed at fixed time intervals,
regardless of how long each task takes. For example, if the code within your run() method
takes two seconds to complete, then your second task starts immediately after the first task
has ended. Similarly, if your delay is set to three seconds and the task takes two seconds to
complete, then the second task waits for one second before starting.

4. Summarize front end languages and framework for mobile app development
Front-end Languages
 The Languages used for front end development are
o HTML
o CSS
o JavaScript
 Provide the Good look and feel of the mobile app
 Front end development is depending on the frameworks such as Dart in flutter,
Javascript in React, Python in Django and so on
HTML

 HTML stands for Hyper Text Markup Language


 HTML is the standard markup language for creating Web pages
 HTML is used to create the architecture of the documentations
 The contents are structured in a specific way in the form of titles ,headings , sub
headings, basic text ,images etc.,
 HTML elements tell the browser how to display the content

CSS
 CSS stands for Cascading Style Sheets.
 It is the language for describing the presentation of Web pages, including colours,
layout, and fonts, thus making web pages presentable to the users.
 CSS is designed to make style sheets for the web.
 It is independent of HTML and can be used with any XML-based markup language.
o Cascading: Falling of Styles
o Style: Adding designs/Styling the HTML tags
o Sheets: Writing the style in different documents
 CSS handles the look and feel part of a web page.
 Using CSS, user can control the color of the text, the style of fonts, the spacing
between paragraphs, how columns are sized and laid out, what background images or
colors are used, layout designs, variations in display for different devices and screen
sizes as well as a variety of other effects.

JavaScript
o JavaScript is a lightweight, cross-platform, single-threaded, and interpreted
compiled programming language.
o It is also known as the scripting language for webpages.
o It is well-known for the development of web pages
o JavaScript is a weakly typed language (dynamically typed).
o JavaScript can be used for Client-side developments as well as Server-
side developments

Frontend Frame works

Frameworks or libraries in app development provide developers with the right tools to help
them in the development process of application.

The most popular libraries in frontend development are

ReactJS

ReactJS, is a JavaScript library specifically designed for building user interfaces (UI) that are
quick easily customizable and flexible. ReactJs is an open source component based frontend
library that is only responsible for application’s view layer.

Angular JS

AngularJs is an open source JavaScript front-end framework that is mostly used to create
single page web applications. It is a framework that is always evolving and providing better
ways to develop online applications. The static HTML is replaced by dynamic HTML. It adds
directives to HTML attributes and uses HTML to bind data.

jQuery
jQuery is a free JavaScript framework that makes it easier to handle HTML/CSS documents.
It simplifies HTML documents manipulation,browser event handling, DOM animations and
cross-browser JavaScript programming.

5. Discuss the steps to manage changes to screen orientation.


 Screen Orientation, also known as screen rotation, is the attribute of activity
element in android.
 When screen orientation change from one state to other, it is also known
as configuration change.
States of Screen orientation
There are various possible screen orientation states for any android application
 ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
 ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
 ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
 ActivityInfo.SCREEN_ORIENTATION_USER
 ActivityInfo.SCREEN_ORIENTATION_SENSOR
 ActivityInfo.SCREEN_ORIENTATION_BEHIND
 ActivityInfo.SCREEN_ORIENTATION_NOSENSOR
 ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
 ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
 ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
The initial orientation of the Screen has to be defined in the AndroidManifest.xml file.
Syntax:
<activity android:name="package_name.Your_ActivityName"

android:screenOrientation="orientation_type">

</activity>
Example:
android:screenOrientation="orientation_type">
 two activities of different screen orientation.
o The first activity will be as ―portrait‖ orientation and
o Second activity as ―landscape‖ orientation state.
Step-by-Step demonstration:
 Creating the activities: There will be two activities and hence two XML files, one for
each activity.
1. activity_main.xml: XML file for first activity consist of constraint layout with Button
and Text View in it. This activity is in Landscape state.
2. activity_next.xml: XML file for second activity consist of constraint layout with Text
View in it. This activity is in Landscape state.
Creating the Java file: There will be two activities and hence two Java files, one for each
activity.
1. MainActivity.java: Java file for Main Activity, in which setOnClick() listener is
attached to the button to launch next activity with different orientation.
2. NextActivity.java: Java file for Next Activity which is in Landscape mode.
Updating the AndroidManifest file:
 In AndroidManifest.xml file, add the screenOrientation state in activity along with its
orientation.
 Here, provide ―portrait‖ orientation for MainActivity and ―landscape‖ for
NextActivity.

6. Determine the purpose of consuming JSON services.

Consuming JSON services in Android (or in any web-based application) refers to retrieving
data in the JSON (JavaScript Object Notation) format from a remote server and using it
within your application. JSON is a lightweight, human-readable data interchange format
commonly used for exchanging data between a client (your app) and a server.

The purpose of consuming JSON services includes:

1. Data Communication with Remote Servers

 Remote Data Retrieval: JSON is widely used in web APIs to exchange data. By
consuming JSON services, an Android app can retrieve data from remote servers or
web services. For example, an app might fetch data from a server (such as weather
information, news articles, or product data) in JSON format.
 Real-time Updates: JSON services allow apps to get up-to-date data from the server.
For example, social media apps or messaging apps often use JSON APIs to fetch the
latest posts, chats, or notifications in real time.
2. Standardized Data Exchange Format

 Cross-Platform Compatibility: JSON is language-independent and can be used


across different platforms (web, Android, iOS, etc.). It ensures that data can be shared
between different systems (such as servers written in different programming
languages) without worrying about compatibility issues.
 Lightweight: JSON is compact, making it ideal for low-latency and efficient data
exchange over the internet. It's much lighter than XML, which makes it a preferred
choice for mobile applications to conserve bandwidth.

3. Dynamic Content

 Customizable Data: JSON allows flexible, dynamic content. The data returned can
be in the form of a list, object, or even nested data, and this can be tailored to the
app’s needs (e.g., querying a specific subset of information from the server). This
gives apps the ability to display dynamic data that can change or be customized based
on user interaction or other factors.
 Interactive Features: Many modern apps rely on consuming JSON data to offer
interactive and customizable experiences, such as dynamic forms, content filters, or
user-specific data (e.g., user preferences or profiles).

4. Integration with Third-Party Services

 Third-Party API Integration: Consuming JSON services is essential for integrating


third-party APIs (e.g., Google Maps, weather services, payment gateways, etc.). Most
APIs offered by third-party services provide responses in JSON format, and
consuming these services allows apps to add functionality like maps, location
tracking, payment processing, and more.
 Cloud-Based Services: Many cloud services (such as Firebase, AWS, and others) use
JSON to transmit data between client apps and their servers. Consuming JSON allows
mobile apps to store, retrieve, and manipulate data stored remotely.

5. App Development Best Practices

 Separation of Concerns: Consuming JSON services helps maintain a clear


separation between the app’s UI and its data layer. The data-fetching and parsing
logic can be isolated, which simplifies code maintenance and improves the app’s
modularity.
 Error Handling: When consuming JSON services, error handling is critical. JSON
parsing allows developers to handle errors like malformed JSON, network
connectivity issues, and server errors gracefully.

You might also like