Q.1) List various tools for android application development.
1. Android Studio
2. Eclipse IDE with Android Development Tools (ADT) Plugin
3. IntelliJ IDEA
4. Visual Studio Code
5. Xamarin
6. Firebase
Q.2) Explain various view and view group.
Views:
A View is a basic UI building block that represents an element that can be
drawn on the screen. It is an object that the user can interact with. Here are
some commonly used Views:
1. TextView: Displays text to the user.
2. EditText: Allows user input for text.
3. Button: A clickable button for performing actions.
4. ImageButton: A button with an image instead of text.
5. DatePicker: Allows users to select a date.
6. RadioButton: Allows selection of a single option from a group.
7. CheckBox: Allows selection of multiple options from a group.
ViewGroup:
A ViewGroup is a special type of View in Android that acts as a container for
other views and view groups. It provides the layout structure in which child
views are arranged and managed.
1. LinearLayout: Arranges views in a single row or column.
2. RelativeLayout: Positions views relative to each other or the parent.
3. FrameLayout: Stacks views on top of each other.
4. GridView: Displays items in a two-dimensional grid.
5. ListView: Displays a scrollable list of items.
Q3) Describe Dalvik Virtual Machine(DVK).
• The Dalvik Virtual Machine (DVM) is an android virtual machine
optimized for mobile devices.
• It optimizes the virtual machine for memory, battery life and
performance.
• The Dex compiler converts the class files into the .dex file that run on the
Dalvik VM. Multiple class files are converted into one dex file.
Importance of DVM:
• Resource Efficiency
• Battery and Performance Optimization
• Application Compatibility
• Multi-User Support
Q.4) List any four attributes of check box.
• android:autoText
• android:drawableBottom
• android:drawableRight
• android:editable
• android:text
Q.5) Differentiate between DVM and JVM
Q.6) Describe how linear and absolute layout is used to design an android
application with suitable example.
LinearLayout
• Description: Arranges child views in a single direction—either vertically
or horizontally.
• Usage: Simple layouts where elements need to be stacked in a straight
line.
• Example:
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, World!" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me" />
</LinearLayout>
AbsoluteLayout
• Description: Places child views at specific X and Y coordinates on the
screen.
• Usage: Rarely used as it does not support responsive design; mainly used
in older applications.
• Example:
<AbsoluteLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, World!"
android:layout_x="50dp"
android:layout_y="100dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me"
android:layout_x="50dp"
android:layout_y="200dp" />
</AbsoluteLayout>
Q.7) Describe how linear and frame layout is used to design an android
application with suitable example.
FrameLayout
• FrameLayout is used to stack child views on top of each other, with the
last added child view being on top.
• It's useful for displaying one view at a time or overlapping views.
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me" />
</LinearLayout>
Q.8) Write down the steps to install and configure Android studio.
1. Download Android Studio:
o Go to the Android Studio website and download the installer for
your operating system.
2. Install Android Studio:
o Run the downloaded installer and follow the on-screen instructions
to install Android Studio.
3. Launch Android Studio:
o Open Android Studio after installation.
4. Initial Setup:
o Choose whether to import settings from a previous installation or
start fresh.
o Click "OK" to proceed.
5. Download SDK Components:
o Android Studio will prompt you to download the Android SDK,
SDK Tools, and SDK Platform Tools. Click "Next" and complete
the download and installation.
6. Configure SDK:
o Go to File > Settings (or Android Studio > Preferences on macOS).
o Navigate to Appearance & Behavior > System Settings > Android
SDK and ensure the SDK paths and installed components are
correct.
7. Create a New Project:
o Click "Start a new Android Studio project" and follow the setup
wizard to create your first project.
8. Install Emulator (if needed):
o Go to Tools > AVD Manager and create an Android Virtual Device
(emulator) to test your apps.
9. Run and Test:
o Connect a physical device or start the emulator.
o Click the "Run" button to build and run your app.
Q9) Android Architecture with its diagram.
Q10) Gridview with its attributes with suitable example
• GridView is a type of ViewGroup that displays items in a two-
dimensional, scrollable grid.
• It is often used for displaying a collection of items, such as images or
text, in a grid layout.
Attributes
1. android:numColumns
o Description: Specifies the number of columns in the grid.
o Example: android:numColumns="3"
2. android:horizontalSpacing
o Description: Sets the horizontal spacing (in pixels) between
columns.
o Example: android:horizontalSpacing="10dp"
3. android:verticalSpacing
o Description: Sets the vertical spacing (in pixels) between rows.
o Example: android:verticalSpacing="10dp"
4. android:stretchMode
o Description: Determines how the grid items should stretch to fill
the space. Options include columnWidth, spacing, none, or fill.
o Example: android:stretchMode="columnWidth"
5. android:gravity
o Description: Specifies the alignment of the grid items within each
cell.
o Example: android:gravity="center"
Q.11) Design and develop a Login form with the help of Table layout as well
as display a message “Login is Successful” at the bottom of the screen, after
clicking on the Login button.
XML Layout (res/layout/activity_main.xml):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="1"
android:layout_centerVertical="true">
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username:"
android:layout_marginEnd="8dp" />
<EditText
android:id="@+id/username"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Enter username" />
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password:"
android:layout_marginEnd="8dp" />
<EditText
android:id="@+id/password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Enter password"
android:inputType="textPassword" />
</TableRow>
<TableRow>
<Button
android:id="@+id/loginButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:layout_span="2" />
</TableRow>
</TableLayout>
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login is Successful"
android:visibility="gone"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:paddingTop="16dp" />
</RelativeLayout>
MainActivity.java
package com.example.loginform;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
private EditText usernameEditText;
private EditText passwordEditText;
private Button loginButton;
private TextView messageTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
usernameEditText = findViewById(R.id.username);
passwordEditText = findViewById(R.id.password);
loginButton = findViewById(R.id.loginButton);
messageTextView = findViewById(R.id.message);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Logic for successful login
messageTextView.setVisibility(View.VISIBLE);
}
});
}
}
Q.12) Design and develop a Login form with the help of Linear layout as
well as display a message “Login is Successful” at the bottom of the screen,
after clicking on the Login button
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter username"
android:layout_marginBottom="8dp" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter password"
android:inputType="textPassword"
android:layout_marginBottom="16dp" />
<Button
android:id="@+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login" />
</LinearLayout>
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login is Successful"
android:visibility="gone"
android:layout_gravity="center_horizontal"
android:paddingTop="16dp" />
</LinearLayout>
package com.example.loginform;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
private EditText usernameEditText;
private EditText passwordEditText;
private Button loginButton;
private TextView messageTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
usernameEditText = findViewById(R.id.username);
passwordEditText = findViewById(R.id.password);
loginButton = findViewById(R.id.loginButton);
messageTextView = findViewById(R.id.message);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Logic for successful login
messageTextView.setVisibility(View.VISIBLE);
}
});
}
}
MainActivity.java
package com.example.loginform;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
private EditText usernameEditText;
private EditText passwordEditText;
private Button loginButton;
private TextView messageTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
usernameEditText = findViewById(R.id.username);
passwordEditText = findViewById(R.id.password);
loginButton = findViewById(R.id.loginButton);
messageTextView = findViewById(R.id.message);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Logic for successful login
messageTextView.setVisibility(View.VISIBLE);
}
});
}
}
Q.13)Write a program to display one EditText and two Buttons (next and
Previous). Click the next button and jump to the second page using java
and xml code.
Q14) Differentiate between Android Studio and Visual Studio with
points.(with all point)
Q15) Describe relative layout with attribute and example
RelativeLayout is a type of ViewGroup in Android that arranges its child views
relative to each other or to the parent container.
It allows for flexible and complex layouts by positioning views in relation to
each other.
Attributes
1. android:layout_below
o Description: Positions the view below the specified view.
o Example: android:layout_below="@id/previousView"
2. android:layout_above
o Description: Positions the view above the specified view.
o Example: android:layout_above="@id/nextView"
3. android:layout_toLeftOf
o Description: Positions the view to the left of the specified view.
o Example: android:layout_toLeftOf="@id/anotherView"
4. android:layout_toRightOf
o Description: Positions the view to the right of the specified view.
o Example: android:layout_toRightOf="@id/anotherView"
5. android:layout_alignParentTop
o Description: Aligns the top edge of the view with the top edge of
the parent container.
o Example: android:layout_alignParentTop="true"
Q16) Differentiate between Eclipse and Netbeans with points.
Q17)Display toast with registration form with intent.