0% found this document useful (0 votes)
39 views159 pages

MAD Lab Manual Answers

The document provides a tutorial on setting up the Android SDK and development environment, specifically for Windows users. It outlines the installation steps for the SDK, setting up the Android Development Tools (ADT) plugin for Eclipse, and creating an Android Virtual Device for testing applications. Additionally, it includes practical questions and exercises related to Android programming concepts and tools.

Uploaded by

Surabhi Gharat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
39 views159 pages

MAD Lab Manual Answers

The document provides a tutorial on setting up the Android SDK and development environment, specifically for Windows users. It outlines the installation steps for the SDK, setting up the Android Development Tools (ADT) plugin for Eclipse, and creating an Android Virtual Device for testing applications. Additionally, it includes practical questions and exercises related to Android programming concepts and tools.

Uploaded by

Surabhi Gharat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 159
Mobile Application Development 422617) from Android's official website: hitp/developer.android.com’sdk/index html. If you are installing SDK on Windows machine, then you will find ainstaller windows.exe. so just download and run this exe which will launch Android SDK Tool Setup wizard to suide you throughout the installation, so just follow the instructions carefully. Finally. you will have Android SDK Tools installed on your machine. If you are installing SDK cither on Mac OS or Linux. check the instructions provided along with the downloaded andreid-sdk_rXX-macosx.zip file for Mac OS and android- sdk_cXXAinwxtzz file for Linux. This tutorial will consider that you are w setip Your environment on. Windows machine having Windows 7 operating system. Step 3 ~ Setup Android Development Tools (ADT) Plugin This step will help you in setting Android Development Tool plugin for Eclipse. Le's start with launching Eclipse and tien, choose Help > Software Updates > Install New Software. This will display the following dialogue bos. Step 4- Create Android Virtual Device to test your Android applications you will need a virtual Android device. So before we start writing our code. let us create an Android virtual device. Launch Android AVD Manager using Eclipse menu options Window > AVD Manager which will launch Android AVD Manager. Use New button to ereate a new Android Virtual Device and enter the following information, before clicking Create AVD button. VIL Resources required (Additional) Instrument Specifeation ‘Quantity | Remarks Wbject IX, Practical related Questions: Note: Below given are few sanrple questions for reference, Teachers must design more such questions ta ensare the achievement af identified CO, 1. Listall the steps to install android eperating system 2. List various IDEs that can be used to exccule android operating system, (Space for answers) STEP 1: Download Google Android OS. STEP 2: Write ISO Image File to CD DVD or USB Drive. STEP 3: Boot Your Computer Using CD DVD or USB Drive STEP 4; Install or Test Run Google Android in Your Computer Ans Android studio Komodo Eclips Contowo Intel Idea Netbeans Visual Studio Miharashira State Board of Technical Education 10 Mobile Application Development{22617) from Android's official website: hup://developer android. com’sdk index html, If you are installing SDK on Windows machine, then you will find ainstaller #XX- windows.exe. so just download and run this exe which will launch Android SDK Tool Setup wizand to guide you throughout the installation, so just follow the instructions carefully. Finally, you will have Android SDK Tools installed on your machine. If you are installing SDK cither on Mac OS or Linux, check the insiructions provided along with the downloaded android-sdk_rXN-macosy rip file for Mac OS and android- sdk_rXXelinuctyz file for Linux. This tutorial will consider that you are going to setup your environment on Windows machine having Windows 7 operating system. Step 3 - Setup Android Development Tools (ADT) Plugin This step will help you in selling Android Development Tool plugin for Eclipse. Let's start with launching Felipse and then. choose Help> Software Updates > Install New Software, This will display the following dialogue bo. Step 4 = Create Android Virtual Device to test your Android applications you will need a virtual Android device, So before we stat writing our cede. let us create an Androit virtual device. Launch Android AVD Manager using Eclipse menu options Window > AVD Manager which will launch Android AVD Manager, Use New button to create a new Android Virtual Device and enter the following information, before clicking Create AVD button, VIL. Resources required (Additional) Instrument Specification Quantity | Remarks sObject TX, Practteal related Questions Note: Below given ere few sample questions for reference, Teachers must design more such questions fo ensare the achievement of identified CO. 1. List all the steps to install android operating 2. List various IDEs that can be used io execute ancroid operating system (Space for answers) STEP |: Download Google Android OS. STEP 2: Write ISO Image File ta CD'DVD or USB Drive. STEP 3: Boot Your Computer Using CD‘DVD or USB Drive. STEP 4: Install or Test Run Google Android in Your Computer A Angroid studio Komodo Eclipse Contovo: Intell) Idea Netbeans Visual Stadio “Maharashtra State Board.of Technical Edocation Mobile application Development (236 Ne Exercise Note: Faculey must ensure that every group af students ase differen input value. (Use blank space for answers or attach more pages if needed) 1, Differentiate between JVM and DVM. 2. What is IDE? Why Java development toolkit is essential to install an sndroid operating system? (Space for answers) Anst JVM is the virtual machine that runs java code on different platforms, It acts as an abstract layer between the program and the platform on which the java code is running, The portability of Java code is possible only because of the SVM. The Ja comptier converts the source code file(Java Me) into. an intermediate Java bytecode format which is machine’platform independent DVM isa virtual machine to execute Android applications. The lava bytecodet.class file) generated by javac compiler is converted into Dalvk bytecade to make the applivation source files executable on the DVM. Since Android devises have a definite processing capacity, memory, and battery life, the DVM design principle in toad fasily and run smoothly ev aims to optimize itself'so Ans it memory powered devices Ans 2 An IDE. or Integrated Development Environment. enables programmers to consolidate the different aspects of writing a computer program. IDEs increase programmer productivity by combining common activities of writing software into a si application: editing souree code, building executables, and debugging References / Suggestions far further Reading 1. betps:!'www-twtorialspoint convandroid 2, bttps://stuff.miteda 3, hups:!Avew rutorialspoint.com/android’android_savanced_tutorial pat 4. hhtips:édeveloper android com XI Assessment Scheme Performance indicators | Weigntage Process related (10 Marks) 3% “1. [ Logic Formation 10% 2 [ Debugging ability 15% 3. | Follow ethical practices Fe _ Product related (93 Marks) 0% 4. [ntrastive GUL 20% 3_| Answer to Practical related questions 2% 6. | Expected Output 2 7._| Timely Submission 10% Total (25 Marks) 100% ‘Maharashtra State Board of Technical Education TT ANDROID DEVELOPER TOOLS The ADT Bundle includes everything you need to begin developing apps: 1 Android studio + ADT plugin 1 Android SDK Toots Android Platform-toals 1 The latest Android platform The latest Android system image for the emulator VIEL. Resources required (Additional) Sr. | Instrument Specification Quantity | Remarks Na._| sObject Practical related Questions ie: Below given are few sample questions for reference. Teachers must design more such questions to ensure the achievement of identified CO. 1. List basie requirements for configuring andruid operating system? 2, Why bytecode cannot run in Android? (Space for answers) Ans 1 Microsoft Windows 7/8/10 (32-bit or 64-bit) 3. GB RAM minimum, § GB RAM recommended (plus 1 GB for the Androtd Emulator) 2.GB of available disk space mlalmum, 4 GB recommended (500 MB for IDE plus 1.5 GB for Android SDK and emulator system ima: 1280 x 800 minimum screen resolution, Ans 2: ‘Android uses Dalvik Virtual Machine (DVM) which requires a special bytecode. We need toconvert Java class files into Dalvik Executable files using an Android tool called “dx” In normal eitcumstances. developers wall not be using this tool directly amd build tools will cate for the generation of DVAI compatible files Exerchse Note: Faculty must ensure that every group of students use different input vetue. (Use blank space for answers or attach more pages if needed) 1, What isa Build Type in Gradle? 2. Explain the build process in Android. ‘Maharashira State Boand of Technical Educ ion 1" Mobile Application Deyslopment {22617} (Space for answers) Ans ‘A build type determines how an app is packaged. By default the Android plug-in for Gradle supports Iwo different types of builds: debug andl relesse, Build types define ceriain properties, that Gradie uses when building and packaging your app. and sre typically configured for different stages of your development lifecycle. For example, the debus build type enables dchug options and signs the APK with the debug key, while the release build type may shrink, obfuscate, and sign your APK wath a release key for distribution, Ans 2 ‘The build process for a typical Android app module. as shown in figure 1 follows these sgoneral steps: 1. The compilers convert your source code imto DEX (Dalvik Executable) files which include the bytecode that runs an Android devices. and everything else into compiled resources The APK Packager combines the DEX files and compiled resources into a APK. Before your app can be installed and deployed ento an Android device, however, the APE musi be signed. 3. The APK Packager signs your APK using either the debug or release keystore! a Lf yoware building a debug version of your app. that is, an app you intend only for testing and profiling. the pac! jens your app with the debug keystore. Android Studio automatically configures now projects with a debus keystore b. Ifyou are huilding a release version of your app that you inl extemally. the packager signs your app with the Felease Key release keystor ng Your app in android studio, 4. Before generating your final APK. the packazer uses the zipline taal too! te optimize your app to use less memory When running on a device ilo release e. Tocteatea, XI. References / Suggestions for further Reading 1. hutps:www.tutorialspoint.com android 2. Bitps://stuffmitedu 3. ilps:/www.tutorialspoint.convandk andrvid_advanced_tutoria| pdf 4. hitps:rideveloper android com Assessment Scheme Performance indicators ‘Welghtage Process related (10 Marks) 30% gic Fomalion bugging ability ~ rae ellucal prachces Product related (I= Marks) | Interactive GUI Answer to Practical related questions 20% $1 Expected Ourput 2 e 7. | Timely Submission TH | Total (25 Marks) —_ 00% | ‘Maharashtra Stale Hoard of Techaisal Education Mobile Application Development (226 17) IX. Practical related Questions Notes Below given are few sample questions for reference. Teackers must design more such questions fo ensure the achievement of identified CO. 1. Listthe files used to write Hello World progeam. 2. What is an activity in Android programming? (Space for answers) Ans 1. The Main Activity File The main activity code is a Java file MainActivity java, This is the actual application file which ultimately gets converted to-a Dalvik executable and runs your application, 2. The Manifest File Whatever component you develop as a part of your application, you must declare all its components in a manifestxml which resides at the root of the application project directory. This file works as an interface between Android OS and your application. then it will not be considered by so if you do not declare your component in this 1 the OS. 3. The Strings File ‘The strings.xmt file is located in the res'values folder and it contains all the text that . the names of buttons, labels, default text, amd textual your application uses, For exam! similar types of strings go into this file, This file is responsible foe U content, 4. The Layout File The activity_main.xmt is a layout file available in res‘layout directory, that is, referenced by your application when building its interface. You will modify this file very frequently to change the layaut af your application Ans 2 An activity is the single screen in android, It is like window or frame of Java, By ivity. you can place all your UL components or widgets in a single sereen method of Activity describes how activity will behave at different states. the help of a The 7 lifee Exercise Note: Faculty must ensure that every group of students use different input wahec, (Use blank space for answers or attach more pages if needed) 1. Write. program to display HelloWortd 2. Write a program to display student name and marks. {Space for answers) ‘Ans |: 1.0" encoding="UIe-S"> > TableLayout IName: Heet ; Marks: 96 Name: Meet ; Marks: 97 Name: Pratik ; Marks: 99 Name: Shaun ; Marks: 91 Name: Naman ; Marks: 97 Name: Hisbaan ; Marks: 92 “Milarashira Siac Bose of Techaisal Educatoa ‘Mobile Application Development4226 17) Linear Layout: - nex t2you YIIL. Resources required (Additional) Tustrument ‘Specification | Quantity Remarks fObject Android enabled 2GBRAM T Data eable is. smartphone / Android mandatory for ! version supporting emulators emulator IX. Practical related Questions Note: Befow given are few sample questions for reference. Teachers must design more such questions to ensure the achievement of identified CO. 1. Name any three-layout manager? 2. What isCard View? Ans. 1, 1. Linear Layout LinearLayout is a view group that aligns all children in a single direction, vertieally or horizontally. 2. Relative Layout RelativeLayout is a view group that displays child views in relative positions. 3. Table Layout TableLayout is a view that groups views into rows and columns. Ans. 2 CardView isa new widget in Android that can be used to display any sort of data by providing a rounded corner layout along with a specific elevation. CardView is the view that san display views on top of each other. The main usage of CardView is tha it helps to givearich feel andlook tothe UL design ‘Makarachira Slate Board of Techancal Education % Mobil Application Development422617b x. Exercise Note: Faculty aust ensure that every group of students use different input value. (Use blank space for answers or attach more pages if needed) 1. Write a program to place Name. Age and mobile number linearly (Vertical) on the display screen using Linear layout Write a program to place Name, Age and mobile number centrally on the display sercen using Absolute layout (Space for answers) 1.0” encoding="utf-8"2> aintlayout widget. ConstraintLayout xmlos:android="htip: schemss android cony/apk‘tes/android” sxmlns:app="hutp:!/schemas android, com‘apkires-auto" sxmnins:tools="bttp:/‘schens android, comlools" android:layent_widh="match_ parent” android:layout_height="match_parent tools:context=" MainActivity"> tools "28dp" android tewt="Name" android textColor=" android textSize androidtextStyle="bold" > TetView android:id="\a tid text View2” android: oyout_widhh="170dp" android layout_height-"wrap_content™ android Jayout_column="2" iarachra Sats Board of Techical Edvcation Fr ‘Mobile Application Development (22617) androdlskiyout_gravity="center™ andro panting Pop "2Sdp aindroad paling Bottom="3Sdp" androaltext-"AGE” android:textCalor=" Te 3" android:textSizo="30sp” android:textStyle="bold” /> le! senter™ "GtiebtentVie andsoid layout_vvidth android layout_heigh android:lay andzid te android textColor="4 1936" android textSize"305p" android textSty le="bold” > Slandroids.constiaintleyout widget ConstrsintLayout™ Saharachtra Stas Hoand of Technical Education Mobile Application Develapment{22617) otra) | BOOLEAN XI. References / Suggestions for further Reading 1. hntps://www.tutorialspoint.com/android 2. hitps://stuff-miteda 3 Mlps:/-www.tutorialspoint.com/android android_advanced_tutorial pdf 4. hilps:{ideveloper.android.com XID, Assessment Scheme ang ability Ferformance Indicators ‘Weightage Process related (10 Marks) 30% Togie Formation 10% Debu:; 15% Follow ethical practices Waharhira State Hownd of Technvcal Education w Mobile Application Dev clopment (22617) IN. — Pruetteal related Questions Note: Betow given are few sample questions for reference. Teachers must design more such questions to ensire the achievement of identified CO, 1. Which of these ts not defined as.a process state? a. Nonsvisible b. Visible ce. Foreground d, Background! What is the name of the folder that contains the R.java file? a ste bes ©. bin @. gen Ans | Non-visible is nol defined as a process state Ans the name of the Foldor that contains dhe R java file is Gen, Exercise Note: Faculty must ensure that every group ofstudeats use different input values (Use blank space for answers or attach more pazes if needed) 1. Write a program to accept username and password from the end user using Text View and Edit Text. 2. Write a program to accept and display personal information of the student. Ang! pk’ rewandoid™ rl oto" (a~id toggle’ android:layoul_width="1 85dp” android-layout_height"wrap_content android: layout_centerlorizontal="tu android layout_margin!orizontal="1 30dp” android android-drawables elector” android textOff="Bluetoolls OFF" android textOn="TBluetoath ON" /> Java Code package com example togglebutton; import androids appcompat app. AppCompatActiv ity import android os Bundle; import android view. View, import android widget ImageView; import android widget. TogaleBulton: Public class Main Activity extends AppCompatActivity { ToggleButton toggleButtan; ImageView imageView: @ Override protected void enCreate(Bundle sawedInstanceState) { super.onCreate(savedinstanceState); seiContentView (Rlayout activity_ma ink: “Mobile Applicatinn Dey clopment (32617), to; ndViewByldtRid tog ley : imiageWiew=find View ByldR td imag eviews image Vjew setImagePrawable(getRe sources|}etDravabletFe drawable Bhuet0o ij th_off)} e(getResourcesty bluetooth _ off): toggleButton setOnClickListenerinew ‘View OnClickListenert) | 1 ‘a Override i public void onClick(View W)t ' if (toggleButton isCheckedt)) ' Toegleguthen toggle buttons Miahorsshita Sais Ioaad of Techaveal Edocatia Mobile Application Development (22617) ‘Ans 2, ML cade encoding "UPS"> android-layout_width="match_parent android tayout_beight-"match_parent horizontal"> idcbin_1” android layeut_widkh="wrap_conte att android:layout_hei ght="wrap_ cont ent” android Tayout_atigaP arent eft="tr we android:layout_alignParertStart="t androwd tayoul_below=" +id ed Te android Layout_marginTop="60Xp" andraid:text="1" android:textSize="18q

You might also like