You are on page 1of 6

1.

Explain any three/four special features of Android SDK

Ans:
- Android is an opensource and freely available software to manufacturers for
customization.
- There are no fixed hardware and software configurations.
- There are a lot of mobile applications that can be chosen by the consumer.
- It provides many interesting features like weather details, opening screen, live
RSS (Really Simple Syndication) feeds etc.
- However, Android itself supports the following features:
 Storage: Uses SQLite, a lightweight database, for data storage.
 Connectivity: Supports GSM/EDGE, CDMA, Bluetooth, Wi-Fi, etc.
 Messaging: Supports both SMS and MMS.
 Web Browser: Based on the opensource WebKit, together with Chromes VB
JavaScript engine.

2. Explain the Resource folder in Adroid SDK in detail.

Ans:
- res stands for resources. Resources stands for small components that are stand-
alone i.e. drawable or the layout.
- Resource folder is the most important folder because it contains all the non-
code sources like images, XML layouts, UI strings for our android application.
- res/drawable folder:
- It contains the different type of images used for the development of the
application. We need to add all the images in drawable folder for the
application development.
- res/layout folder:
- Layout folder contains all XML layout files which we used to define the user
Interface of our application. It contains the activity_main.xml file.
- res/midmap folder:
- This folder contains launcher.xml files to define icons which are used to show
on the home screen. It contains different density type of icons depends upon
the size of the device such as hdpi, mdpi, xhdpi.
- res/values folder:
- Values folder contains a number of XML files like strings, dimens, colors and
styles definitions. One of the most important files is strings.xml file which
contains the resources.
3. Explain the lifecycle of Android Activity Lifecycle Events.

Ans.

- Android Activity Lifecycle is controlled by 7 methods of android.app.Activity


class. The android Activity is the subclass of ContextThemeWrapper class.

- An activity is the single screen in android. It is like window or frame of Java.

- By the help of activity, you can place all your UI components or widgets in a
single screen.

- The 7-lifecycle method of Activity describes how activity will behave at different
states.

onCreate called when activity is first created.

onStart called when activity is becoming visible to


the user.

onResum called when activity will start interacting


e with the user.

onPause called when activity is not visible to the


user.

onStop called when activity is no longer visible to


the user.

onRestart called after your activity is stopped, prior


to start.

onDestroy called before the activity is destroyed.

4. Explain with diagram the Android platform architecture.


Ans.

5 Layer Architecture
o 1 - Linux Kernel – Kernel used to get work done by hardware. Device driver +
Memory management + Process management.
o 2 – Libraries: contains pre-written codes or functions. Libraries are Some logical
instructions that we need for he kernels to do C, C++, Graphics, Interface through
Java, SQL Lite Libraries
o 3 - Application Framework – API Interface, Activity manager.
o 4 – Applications – Present in the system.
o 5 – Android Runtime – Dalvik Virtual Machine (DVM)+Core Libraries.
 Dex files
 Compact and efficient than class files
Limited memory and battery power.

5. Write steps to create AVD (Android Virtual Device) (3/4)


Ans.
- Open the AVD Manager by clicking Tools > AVD Manager.
- Click Create Virtual Device, at the bottom of the AVD Manager dialog.
- The Select Hardware page appears.
- Select a hardware profile, and then click Next.
- If you don't see the hardware profile you want, you can create or import a
hardware profile.
- The System Image page appears.
- Select the system image for a particular API level, and then click Next.
- Change AVD properties as needed, and then click Finish.
- Click Show Advanced Settings to show more settings, such as the skin.
- The new AVD appears in the Your Virtual Devices page or the Select
Deployment Target dialog.

6. Write a specific XML & Java code for the following- (3/4/6) 1.
Listview 2. Radiobutton 3. Textview 4. DatePicker 5. TimePicker

7. The Dalvik Virtual Machine in detail.


Ans.
- 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.

- The javac tool compiles the java source file into the class file.

- The dx tool takes all the class files of your application and generates a single .dex
file. It is a platform-specific tool.

- The Android Assets Packaging Tool (aapt) handles the packaging process.

8. Explain the difference between JVM/DVM (3/4)


Ans.
JVM(Java Virtual Machine) DVM(Dalvik Virtual Machine)

Stack-based VM that performs


arithmetic and logic operations
through push and pop
operands. The result of Register-based VM that uses registers located in
operations is stored in stack the CPU to perform arithmetic and logic
memory. operations.

Source code files are first of all compiled into Java


Java source code is compiled bytecode format like JVM. Further, the DEX
into Java bytecode compiler(dx tool) converts the Java bytecode into
format(.class file) that further Dalvik bytecode(classes.dex) file that will be used
translates into machine code. to create the .apk file.

More information is required to


the VM for data loading and
manipulation as well as method
loading in the stack data Instruction size is larger as it needs to encode the
structure. source and destination register of the VM.

Compiled bytecode size is


compact because the location
of the operand is implicitly on Compiled bytecode size is larger as each
the operand stack. instruction needs all implicit operands.

The executable file for the


device is .jar file. The executable file for the device is .apk file.

A single instance of JVM is


configured with shared
processes and memory space The device runs multiple DVM instances with a
in order to run all deployed separate process in shared memory space to
applications. deploy the code of each application. 

Supports multiple operating


systems like Linux, Windows,
and Mac OS. Support only the Android operation system.

9. Explain Android Manifest File and its common settings in detail


Ans.
- The AndroidManifest.xml file contains information of your package, including
components of the application such as activities, services, broadcast receivers,
content providers etc.
- It performs some other tasks also:

o It is responsible to protect the application to access any protected parts by


providing the permissions.
o It also declares the android api that the application is going to use.
o It lists the instrumentation classes. The instrumentation classes provides profiling
and other informations. These informations are removed just before the
application is published etc.

- This is the required xml file for all the android application and located inside the
root directory.
10. Explain Logcat structure and its importance in details.
11. Write the steps of hello world program

12. Define Intent. State and explain in brief the types of intents with
example. Write a code to explain it.
Ans.

- Android Intent is the message that is passed between components such as


activities, content providers, broadcast receivers, services etc.

- It is generally used with startActivity() method to invoke activity, broadcast


receivers etc.

- The dictionary meaning of intent is intention or purpose. So, it can be described


as the intention to do action.

Types :

1. Implicit Intent:
- Implicit Intent doesn't specifiy the component. In such case, intent provides
information of available components provided by the system that is to be invoked.

For example, you may write the following code to view the webpage.

Intent intent=new Intent(Intent.ACTION_VIEW);  
intent.setData(Uri.parse("http://www.javatpoint.com"));  
startActivity(intent);  

2. Explicit Intent
- Explicit Intent specifies the component. In such case, intent provides the external
class to be invoked.

- For example:

Intent i = new Intent(getApplicationContext(), ActivityTwo.class);  
startActivity(i);  

13. Define activity. Write a program to call an activity from main


activity.
Ans.
- An activity provides the window in which the app draws its UI.
- This window typically fills the screen, but may be smaller than the screen and
float on top of other windows. Generally, one activity implements one screen in
an app.
- The Activity class is a crucial component of an Android app, and the way
activities are launched and put together is a fundamental part of the platform's
application model.

14. Explain the concept of backstack with example.

You might also like