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

Mad Exp 3.3

The document outlines a practical experiment for designing an Android application using menus and action bars, aimed at creating a user-friendly interface. It includes XML code for menu items and layout configurations, as well as Java code for the main activity. Learning outcomes focus on the successful use of the Android development environment and the ability to add new layouts and configure buttons.

Uploaded by

bhushanshashi818
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)
45 views6 pages

Mad Exp 3.3

The document outlines a practical experiment for designing an Android application using menus and action bars, aimed at creating a user-friendly interface. It includes XML code for menu items and layout configurations, as well as Java code for the main activity. Learning outcomes focus on the successful use of the Android development environment and the ability to add new layouts and configure buttons.

Uploaded by

bhushanshashi818
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

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment – 3.3

Student Name:Sumit UID: 21BCS10075


Branch: BE-CSE-IT Section/Group: KRG_SC1_A
Semester: 6th Date of Performance: 02/04/2024
Subject Name: MAD Lab Subject Code: 21CSH-355

Aim of the practical: Design the Android application using menus and action bar
Objective:- The objective of designing an Android application using menus and the action bar
is to create a user-friendly and consistent interface that allows users to navigate, access
functionality, and perform actions efficiently.

1. CODE:
XML:-
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/search_item"
android:title="Search" />
<item android:id="@+id/upload_item"
android:title="Upload" />
<item android:id="@+id/copy_item"
android:title="Copy" />
<item android:id="@+id/print_item"
android:title="Print" />
<item android:id="@+id/share_item"
android:title="Share" />
<item android:id="@+id/bookmark_item"
android:title="BookMark" />
</menu>
<AbsoluteLayout

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

android:layout_width="fill_parent"

android:layout_height="fill_parent"

tools:context=".MainActivity">

<!--Setting up TextViews-->

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_x="100px"

android:layout_y="300px" />

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_x="120px"

android:layout_y="350px" />

</AbsoluteLayout>

<RelativeLayout

android:layout_width="fill_parent"

android:layout_height="fill_parent"

xmlns:android="http://schemas.android.com/apk/res/android">

<Button

android:id="@+id/button1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Top Left Button"


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

android:layout_alignParentLeft="true"

android:layout_alignParentTop="true"/>

<Button

android:id="@+id/button2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Top Right Button"

android:layout_alignParentTop="true"

android:layout_alignParentRight="true"/>

<Button

android:id="@+id/button3"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Bottom Left Button"

android:layout_alignParentLeft="true"

android:layout_alignParentBottom="true"/>

android:id="@+id/button5"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="Middle Button"

android:layout_centerVertical="true"

android:layout_centerHorizontal="true"/>

</RelativeLayout>
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Java Code:-

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

TextView heading, subHeading;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

// Referencing the TextViews

heading = (TextView) findViewById(R.id.heading);

subHeading = (TextView) findViewById(R.id.subHeading);

2. OUTPUT:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

3. Learning Outcomes:
• Successful USE of your Android development environment.
• Project Workspace.
• Configuration button Completion.
• How to add new layouts

You might also like