Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Android web development, Lab Reports of Mobile Computing

Android application lab manual for students of bca/mca

Typology: Lab Reports

2022/2023

Uploaded on 12/15/2023

rinkal-sarvaiya
rinkal-sarvaiya 🇮🇳

1 document

1 / 78

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ST. ANNE’S
COLLEGE OF ENGINEERING AND TECHNOLOGY
ANGUCHETTYPALAYAM, PANRUTI 607 110
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
NAME
:
----------------------------------------------------------
REGISTER NO.
:
----------------------------------------------------------
YEAR/ SEM
:
III / VI
SUBJECT
:
CS8662, MOBILE APPLICATION DEVELOPMENT
LABORATORY
DURATION
:
MAR 2022 JUN2022
LAB OBSERVATION NOTE
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e

Partial preview of the text

Download Android web development and more Lab Reports Mobile Computing in PDF only on Docsity!

ST. ANNE’S

COLLEGE OF ENGINEERING AND TECHNOLOGY

ANGUCHETTYPALAYAM, PANRUTI – 607 110

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

NAME : ----------------------------------------------------------

REGISTER NO. : ----------------------------------------------------------

YEAR/ SEM : III / VI

SUBJECT : CS8662, MOBILE^ APPLICATION DEVELOPMENT

LABORATORY

DURATION : MAR 2022 – JUN 2022

LAB OBSERVATION NOTE

CS8662 MOBILE APPLICATION DEVELOPMENT LABORATORY

LIST OF EXPERIMENTS:

  1. Develop an application that uses GUI components, Font and Colours
    1. Develop an application that uses Layout Managers and event listeners.
    2. Write an application that draws basic graphical primitives on the screen.
    3. Develop an application that makes use of databases.
    4. Develop an application that makes use of Notification Manager.
    5. Implement an application that uses Multi-threading.
    6. Develop a native application that uses GPS location information
    7. Implement an application that writes data to the SD card.
    8. Implement an application that creates an alert upon receiving a message
  2. Write a mobile application that makes use of RSS feed
  3. Develop a mobile application to send an email.
  4. Develop a Mobile application for simple needs (Mini Project)

EX. NO. : 1

Develop an application that uses GUI components, Font and Colors DATE : AIM : To develop an android application that uses GUI Components, Font and colors. ALGORITHM:

  1. Create a New Android Project:
    • Click New in the toolbar.
    • In the window that appears, open the Android folder, select Android Application Project, and click next.
    • Provide the application name and the project name and then finally give the desired package name.
    • Choose a launcher icon for your application and then select Blank Activity and then click Next
    • Provide the desired Activity name for your project and then click Finish.
  2. Create a New AVD (Android Virtual Device):
    • click Android Virtual Device Manager from the toolbar.
    • In the Android Virtual Device Manager panel, click New.
    • Fill in the details for the AVD. Give it a name, a platform target, an SD card size, and a skin (HVGA is default).
    • Click Create AVD and Select the new AVD from the Android Virtual Device Manager and click Start.
  3. Design the graphical layout with a text view and two command buttons.
  4. Run the application.
  5. On pressing the change color button, color of the text gets changed.
  6. On pressing the change font size button, the size of the font gets altered.
  7. Close the Android project. PROGRAM CODE MainActivity.java packagecom.example.gui; importandroid.os.Bundle; importandroid.app.Activity; importandroid.graphics.Typeface; importandroid.graphics.Color; importandroid.view.View; importandroid.widget.Button; importandroid.widget.TextView; publicclassMainActivityextends Activity { float font = 24; inti = 1;

protectedvoidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); finalTextView t1 = (TextView)findViewById(R.id.textView1); Button b1 = (Button)findViewById(R.id.button1); b1.setOnClickListener(newView.OnClickListener() { publicvoidonClick(View view) { t1.setTextSize(font); font = font+4; if(font==40) font = 20; } }); Button b2 = (Button)findViewById(R.id.button2); b2.setOnClickListener(newView.OnClickListener() { publicvoidonClick(View view) { switch(i) { case 1: t1.setTextColor(Color.parseColor("#0000FF")); break; case 2: t1.setTextColor(Color.parseColor("#00FF00")); break; case 3: t1.setTextColor(Color.parseColor("#FF0000")); break; case 4: t1.setTextColor(Color.parseColor("#800000")); break; } i++; if(i==5) i = 1; } }); } }

OUTPUT:

RESULT:

Thus, the program for android application GUI Components, Font and colors was executed successfully.

EX. NO. : 2

Develop an application that uses Layout Managers and Event Listeners DATE : AIM : To develop an android application that uses Layout Managers and event listeners. ALGORITHM:

  1. Create a New Android Project:
    • Click New in the toolbar.
    • In the window that appears, open the Android folder, select Android Application Project, and click next.
    • Provide the application name and the project name and then finally give the desired package name.
    • Choose a launcher icon for your application and then select Blank Activity and then click Next
    • Provide the desired Activity name for your project and then click Finish.
  2. Create a New AVD (Android Virtual Device):
    • click Android Virtual Device Manager from the toolbar.
    • In the Android Virtual Device Manager panel, click New.
    • Fill in the details for the AVD. Give it a name, a platform target, an SD card size, and a skin (HVGA is default).
    • Click Create AVD and Select the new AVD from the Android Virtual Device Manager and click Start.
  3. Design the graphical layout with buttons, edit text and text view.
  4. Run the application.
  5. Provide the required inputs to perform the desired arithmetic operation.
  6. Display the result.
  7. Close the Android project. PROGRAM CODE: MainActivity.java packagecom.example.layout; importandroid.os.Bundle; importandroid.app.Activity; importandroid.view.View; importandroid.view.View.OnClickListener; importandroid.widget.Button; importandroid.widget.EditText; importandroid.widget.Toast; publicclassMainActivityextends Activity { EditText txtData1,txtData2; float num1,num2,result1,result2;

Button clear = (Button)findViewById(R.id.button2); clear.setOnClickListener(newOnClickListener() { publicvoidonClick(View v) { try { txtData1.setText(""); txtData2.setText(""); } catch(Exception e) { Toast.makeText(getBaseContext(),e.getMessage(),Toast.LENGTH_SHORT).show(); } } }); } } activity_main.xml <RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:id="@+id/linearLayout2"

android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_below="@+id/linearLayout1">

OUTPUT:

RESULT:

Thus, the program for android application that uses layout managers and event listeners was executed successfully.

EX. NO. : 3

Write an application that draws basic graphical primitives on the screen DATE : AIM : To develop an android application that draws basic graphical primitives on the screen. ALGORITHM:

  1. Create a New Android Project:
    • Click New in the toolbar.
    • In the window that appears, open the Android folder, select Android Application Project, and click next.
    • Provide the application name and the project name and then finally give the desired package name.
    • Choose a launcher icon for your application and then select Blank Activity and then click Next
    • Provide the desired Activity name for your project and then click Finish.
  2. Create a New AVD (Android Virtual Device):
    • click Android Virtual Device Manager from the toolbar.
    • In the Android Virtual Device Manager panel, click New.
    • Fill in the details for the AVD. Give it a name, a platform target, an SD card size, and a skin (HVGA is default).
    • Click Create AVD and Select the new AVD from the Android Virtual Device Manager and click Start.
  3. Design the layout by adding a ImageView button.
  4. Run the application.
  5. Draw straight line by moving the mouse over the screen.
  6. Close the Android project. PROGRAM CODE: MainActivity.java import android.app.Activity; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.os.Bundle; import android.view.Display; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.widget.ImageView; public class MainActivity extends Activity implements OnTouchListener { private ImageViewimageView;

android:layout_width="match_parent" android:layout_height="match_parent">

OUTPUT:

RESULT:

Thus, the program for android application that draws basic graphical primitives on the screen. was executed successfully.

Button Insert , Delete , Update , View , ViewAll ; SQLiteDatabase db ; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView(R.layout. activity_main ); Rollno =(EditText)findViewById(R.id. Rollno ); Name =(EditText)findViewById(R.id. Name ); Marks =(EditText)findViewById(R.id. Marks ); Insert =(Button)findViewById(R.id. Insert ); Delete =(Button)findViewById(R.id. Delete ); Update =(Button)findViewById(R.id. Update ); View =(Button)findViewById(R.id. View ); ViewAll =(Button)findViewById(R.id. ViewAll ); Insert .setOnClickListener( this ); Delete .setOnClickListener( this ); Update .setOnClickListener( this ); View .setOnClickListener( this ); ViewAll .setOnClickListener( this ); // Creating database and table db =openOrCreateDatabase( "StudentDB" , Context. MODE_PRIVATE , null ); db .execSQL( "CREATE TABLE IF NOT EXISTS student(rollnoVARCHAR,nameVARCHAR,marks VARCHAR);" ); } public void onClick(View view) { // Inserting a record to the Student table if (view== Insert ) { // Checking for empty fields if ( Rollno .getText().toString().trim().length()==0|| Name .getText().toString().trim().length()==0|| Marks .getText().toString().trim().length()==0) { showMessage( "Error" , "Please enter all values" ); return ; } db .execSQL( "INSERT INTO student VALUES('" + Rollno .getText()+ "','" + Name .getText()+ "','" + Marks .getText()+ "');" ); showMessage( "Success" , "Record added" ); clearText(); } // Deleting a record from the Student table if (view== Delete ) { // Checking for empty roll number if ( Rollno .getText().toString().trim().length()==0) { showMessage( "Error" , "Please enter Rollno" ); return ;

Cursor c= db .rawQuery( "SELECT * FROM student WHERE rollno='" + Rollno .getText()+ "'" , null ); if (c.moveToFirst()) { db .execSQL( "DELETE FROM student WHERE rollno='" + Rollno .getText()+ "'" ); showMessage( "Success" , "Record Deleted" ); } else { showMessage( "Error" , "Invalid Rollno" ); } clearText(); } // Updating a record in the Student table if (view== Update ) { // Checking for empty roll number if ( Rollno .getText().toString().trim().length()==0) { showMessage( "Error" , "Please enter Rollno" ); return ; } Cursor c= db .rawQuery( "SELECT * FROM student WHERE rollno='" + Rollno .getText()+ "'" , null ); if (c.moveToFirst()) { db .execSQL( "UPDATE student SET name='" + Name .getText() + "',marks='" + Marks .getText() + "' WHERE rollno='" + Rollno .getText()+ "'" ); showMessage( "Success" , "Record Modified" ); } else { showMessage( "Error" , "Invalid Rollno" ); } clearText(); } // Display a record from the Student table if (view== View ) { // Checking for empty roll number if ( Rollno .getText().toString().trim().length()==0) { showMessage( "Error" , "Please enter Rollno" ); return ; } Cursor c= db .rawQuery( "SELECT * FROM student WHERE rollno='" + Rollno .getText()+ "'" , null ); if (c.moveToFirst()) { Name .setText(c.getString(1)); Marks .setText(c.getString(2)); } else { showMessage( "Error" , "Invalid Rollno" );