Sunteți pe pagina 1din 14

Q.1 Can we pass object inside Activity? Ans.

Yes we can do but for that we have to make object as Serialize. Q.2 How to disply message when Activity communicating with Service? Ans. Through Toast you can do like: Toast.makeText(this,Mesage,Toast.Length_short).show(); Q.3 Use of parcebel in Androoid? Q.4 What is Intent Reciever? Ans. Responds to Notifications or statuschanges. Can wake up your process. Q.5 How to do security in Android? Ans. In Mnifest file we can define permissions. Q.6 What is COCOMO model? Q.7 What is Category in Intent? Ans. Q.8 How one Activity comunicating with other Activity? Ans. Through Intents you can do like you are having two classes A & B the Create Intent object: Intent i= new Intent(this(A), B.class); StartActivity(i); Q.9 Various way of registring BroadCastReciever? Ans. Through two way's we can do either we can use RegisterReciever() method or in Manifest file. Q.10 How to disply notification at the time of listning connection? Ans. Through Toast you can do. Q.11 Can we use Toast inside Service? Ans. Yes at the where you are binding your Activity with Service. Q.12 If i wants to save data till user session which mechanism i'll use? Ans. Sharedpreference Q.13 Difference between margin and padding? Ans. When we are incresing white space in betwen widgets then we are using margin. Q.14 What is BroadCastReciver and which method we have to overwrite? Ans. Its reciving intents send by sendbroadcast.Like bettery is running low else time zone change Public void onRecieve(Context, Intent); Q.15 Difference between Jvm And Dvm? Ans. DVM specific for small devices because data structure is good and memory efficiney 50% c/m to JVM. DVM : DelvikComplier compiling .jar and .class files into .dex file . Q.16 How will you do Aapter opration means which method you have to override? Following methods : 1.public int getCount(){return country.length;}

2.public Object getItem(int position){ return position;} 3.public Long getItemId(int position){ return position;} 4.public view getView(int position, View convertview,viewgroup parent) {return convertView;} Q.17 how to pass data inside intent Ans. intent.putExtra(A,Hello) then intent.getStringExtra()? Q.18 Thread timmer class in java? Q.19 Order of tree set when adding value? Q.20 Android Architecture? Ans. Bottom layer is Kernel layer overthere having driver like camera,sound, bluetooth above this having libraries in c & c++ like sqlite,webkit, open GLES along with java runtime above that Application framework like Activity Manager, XMPP service.... above that applications like Contact , Calender.... Q.21 how wait() method will invoke(by using notify and notifyAll)? Q.22 Difference between Thread class and Runnable Interface? Q.23 What is task in android? Ans. Collections of Activity is called task. Q.24 What is Activity Stack? Ans. ActivityStack similer to java Stack its maintaining the order of Activity. Q.25 What is inter process communication(IPC)? Ans. We are using when we want to communicate in between process by using Ibinder. Q.26 What is Intent and what is explicit and implicit intent? Ans. Intent are system message running inside device and notifying application about various events like h/w state change SD card inserted or Incoming data like SMS. Q.27 Content Provider example? Ans. Content Provider provide abstraction of data stored on deveice and access by multiple aplications. Q.28 What are the methods we need when communicating with DataBase? Ans. GetWritable(), getReadable(). Q.29 Example of Various Adapter? Ans. ArrayAdapter, CursorAdapter.... Q.30 Difference between various Layouts? Ans.

LinearLayout : LinearLayout is a ViewGroup that displays child View elements in a linear direction, either vertically or horizontally. You should be careful about over-using the LinearLayout. If you begin nesting multiple LinearLayouts, you may want to consider using a RelativeLayout instead. RelativeLayout : RelativeLayout is a ViewGroup that displays child View elements in relative positions. The position of a View can be specified as relative to sibling elements (such as to the left-of or below a given element) or in positions relative to the RelativeLayout area (such as aligned to the bottom, left of center). A RelativeLayout is a very powerful utility for designing a user interface because it can eliminate nested ViewGroups. If you find yourself using several nested LinearLayout groups, you may be able to replace them with a single RelativeLayout. <Button android:id="@+id/ok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/entry" android:layout_alignParentRight="true" android:layout_marginLeft="10dip" android:text="OK" /> Table Layout : TableLayout is a ViewGroup that displays child View elements in rows and columns. Q.31 What is AIDL? Ans. Android Interface Defination Language. Q.32 What is Service how you will implement in your programe? Ans. Service menas no ui , for that you have to extends Service class over there you have to @override public Ibinder onBind(Intent intent). Then inside class which is extending Activity class inside that you have to define another class that class will implement SericeConnection. Then you have connect service by using public void onServiceConnected(Component name,Ibinder bind) public void onServiceDisconnected(Componenet name) for binding your activity with service for that you have to create Intent object and class object whoes implement ServiceConnection class. Intent i= new Intent();

ServiceConnectionClass connection; i.setClassName(); Bollean b=bindservice(i,connection,context.bind_Auto_Create); for unbind: unbind(connection); Q.33 What is Custom Widget? And. You can customize your widget by extends View class. Q.34 How will you do URL connection in Android? Q.35 How you will record Audio in Android? Q.36 What are the permissions in Android? Ans. Like bluetooth enabled is true. Q.37 What is R.java? Ans. Its containing constant. Q.38 What is Cursor? Ans. Cursor similer to ResultSet for holding data return by select stament. Q.39 Did you ever use URI in your application? Q.40 What is difference between JavaThread and Android Service? Q.41 What is the use of Manifest.XML file? Ans. Its starting point of your application. Q.42 Q.43 Q.44 Q.45 Q.46 Q.47 What is ADB? What is DOM parser and how SAX parser will work? How to AutoStart apllication in Android? Structure of .APK file? Describe Acivity life cycle briefly? How bluetooth is working?

Q.48 Whats the difference between a TableLayout and a ListView? Ans. Items in a TableLayout are not selectable (unless they are buttons or text areas that support keyboard focus), however, each row of a ListView can be selected. Its just like a Swing JList. You can attach item selection listeners to a ListView to know when the user focuses in on a particular row of a list. The biggest difference between a Swing JList and a ListView is that the model view controller separation in JList is not there in ListView. A ListViews adapter, holds all the lists underlying data as well as the Views necessary to render each row of the ListView. However, there are many similarities with JList, for example, when your underlying data model changes, you have to fire an event to notify the adapters listeners that the underlying data has changed, and the views should be refreshed. The ListView does not need to be added to a ScrollView

since it automatically supports scrolling. Q.49 How to define Custom Adapter? Ans. First extends BaseAdapter public class Avinash extends Activity{ private static class EfficientAdapter extends BaseAdapter{ Then overrite the getview method : public view getView(int position, View ConvertView, ViewGroup Parent){ ViewHolder holder; convertView.setTag(holder); return convertView;} @override public void Oncreate(Bundle ....){ ListView l= (ListView) findViewById(R.ld.listview01); l.setAdapter(new EfficientAdapter(this)); } http://www.androidpeople.com/android-custom-listview-tutorial-example/ http://www.higherpass.com/Android/Tutorials/Creating-Lists-Using-The-AndroidListactivity/ Q.50 How to create simple ListView? Ans. 1. Define ListView in layout file like: <ListView android:id=@android:id/list android:layout_width=fill_parent android:layout_height=wrap_content/> 2. extends ListActivity in your class like: import android:widget.ArrayAdapter; class SimpleListItem extends ListActivity{ String[] items={A,B};

@override public void onCreate(Bundle SavedInstanceState){ super.onCreate(SavedInstanceState); setContentView(R.layout.main); setListAdapter(new ArrayAdapter(this,android.R.layout.simple_list_item_1,items)); } } Q.51 Reason for geting Activity not responding dialog box? Ans. No response to an input event (e.g. key press, screen touch) within 5 seconds A BroadcastReceiver hasn't finished executing within 10 seconds Q.52 What is LogCat? Ans. o/p message what compiler giving like: log.i(Tag,Message); This is Information log.e(Tag,Message); This is Error log.v(Tag,Message); This is for Verbose log.d(Tag,Message); This is for debug log.w(Tag,Message); This is for warning

Q.52 How to make Customize widget? Ans. http://androidcore.com/android-programming-tutorials/235-making-acustom-android-button-using-a-custom-view.html 1. Extends View class 2. then c'tor for setting Image and label. 3. Then override protected void ondraw(Canvas canvas){} protected void onMeasure(int measure width,measure height){} Q.53 How to pass information between Avtivities? Ans. public class A extends Activity { @Override public void onCreate(Bundle savedInstanceState) {

// code here Intent i = new Intent( this, B.class ); i.putExtra( "int", 5); i.putExtra( "string", "hello" ); startActivity( i ); } } public class B extends Activity { @Override public void onCreate(Bundle savedInstanceState) { // code here Intent i = getIntent(); int number = i.getIntExtra("int", -1); String str = i.getStringExtra("string"); // number = 5 // str = "hello" } } So basically the idea is you pass the intent to Class B and the intent acts like a standard Map object. For getIntExtra, if the app cant find the value with key integer, then -1 is returned as the default, and for getStringExtra, if the app cant find the key then null is returned. Q.54 How to send Custom Intents and grab them? Ans. This example has two receivers and an android manifest file: The First Receiver: public class OutgoingReceiver extends BroadcastReceiver { public static final String CUSTOM_INTENT = "jason.wei.custom.intent.action.TEST";

@Override public void onReceive(Context context, Intent intent) { System.out.println("HIT OUTGOING"); Intent i = new Intent(); i.setAction(CUSTOM_INTENT); context.sendBroadcast(i); } }

The Second Receiver: public class IncomingReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(OutgoingReceiver.CUSTOM_INTENT)) { System.out.println("GOT THE INTENT"); } } } Android Manifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="jason.wei.apps.androidtest" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <receiver android:name=".OutgoingReceiver" android:enabled="true"> <intent-filter> <action android:name="android.intent.action.PHONE_STATE"></action> </intent-filter> </receiver> <receiver android:name=".IncomingReceiver" android:enabled="true"> <intent-filter> <action android:name="jason.wei.custom.intent.action.TEST"></action> </intent-filter> </receiver> </application>

<uses-sdk android:minSdkVersion="3" /> <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission> </manifest> --------------------------------------------------------------------------Explain about the exceptions of Android. The following are the exceptions that are supported by Android

InflateException : When an error conditions are occurred, this exception is thrown Surface.OutOfResourceException: When a surface is not created or resized, this exception is thrown SurfaceHolder.BadSurfaceTypeException: This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS WindowManager.BadTokenException: This exception is thrown at the time of trying to add view an invalid WindowManager.LayoutParamstoken.

Frequently Asked Questions


What is Android OS? What is android? What are the advantages of Android? Explain about the exceptions of Android? What is .apk extension? What is .dex extension? and more android interview questions and answers. what is Open Source ? What is the Android Open Source Project? Why did we open the Android source code? What kind of open-source project is Android? Why is Google in charge of Android? What is Googles overall strategy for Android product development? How is the Android software developed? Why are parts of Android developed in private? When are source code releases made? What is involved in releasing the source code for a new Android version? How does the AOSP relate to the Android Compatibility Program? How can I contribute to Android? How do I become an Android committer? Compatibility When are compatibility definitions released for new Android versions? How are device manufacturers compatibility claims validated? What happens if a device that claims compatibility is later found to have compatibility problems? Compatibility Test Suite What is the purpose of the CTS? What kinds of things does the CTS test?

Will the CTS reports be made public? How is the CTS licensed? Does the CTS accept contributions? Can anyone use the CTS on existing devices? What does compatibility mean? What is the role of Android Market in compatibility? What kinds of devices can be Android compatible? If my device is compatible, does it automatically have access to Android Market and branding? If I am not a manufacturer, how can I get Android Market? How can I get access to the Google apps for Android, such as Maps? Is compatibility mandatory? How much does compatibility certification cost? How long does compatibility take? Who determines what will be part of the compatibility definition? How long will each Android version be supported for new devices? Can a device have a different user interface and still be compatible?

Introduction Android:
Android Introduction: Android is an open source operating system for mobile devices that includes middleware and key applications, and uses a modified version of the Linux kernel. It was initially developed by Android Inc. It allows developers to write managed code in the Java language, controlling the device via Google-developed Java libraries.. The Android SDK includes a comprehensive set of development tools . These include a debugger, libraries, a handset emulator (based on QEMU), documentation, sample code, and tutorials. Currently supported development platforms include x86-architecture computers running Linux ,Mac OS X 10.4.8 or later, Windows XP or Vista. Android does not use established Java standards, i.e. Java SE and ME. This prevents compatibility among Java applications written for those platforms and those for the Android platform. Android only reuses the Java language syntax, but does not provide the full-class libraries and APIs bundled with Java SE or ME What is android? Android is a software stack for mobile devices which has Operating System, middleware and some key applications. The application executes within its own process and its own instance of Dalvik Virtual Machine. Many Virtual Machines run efficiently by a DVM device. DVM executes Java language?s byte code which later transforms into .dex format files. What are the advantages of Android? The following are the advantages of Android:

* Features like weather details, live RSS feeds, opening screen, icon on the opening screen can be customized * The customer will be benefited from wide range of mobile applications to choose, since the monopoly of wireless carriers like AT&T and Orange will be broken by Google Android.

* Innovative products like the location-aware services, location of a nearby convenience store etc., are some of the additive facilities inAndroid. Components can be reused and replaced by the application framework. *Optimized DVM for mobile devices *SQLite enables to store the data in a structured manner. *Supports GSM telephone and Bluetooth, WiFi, 3G and EDGE technologies *The development is a combination of a device emulator, debugging tools, memory profiling and plug-in for Eclipse IDE. Features of Android : Application framework enabling reuse and replacement of components Dalvik virtual machine optimized for mobile devices Integrated browser based on the open source WebKit engine Optimized graphics powered by a custom 2D graphics library; 3Dgraphics based on the OpenGL ES 1.0 specification (hardware acceleration optional) SQLite for structured data storage Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF) GSM Telephony (hardware dependent) Bluetooth, EDGE, 3G, and WiFi (hardware dependent) Camera, GPS, compass, and accelerometer (hardware dependent) Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE. Explain about the Android Exceptions ? The following are the exceptions that are supported by Android * InflateException : When an error conditions are occurred, this exception is thrown

* Surface.OutOfResourceException: When a surface is not created or resized, this exception is thrown

* SurfaceHolder.BadSurfaceTypeException: This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS

* WindowManager.BadTokenException: This exception is thrown at the time of trying to add view an WindowManager.LayoutParamstoken. Describe the APK format ?

invalid

The APK file is compressed the AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file. What is .apk extension? The extension for an Android package file, which typically contains all of the files related to a single Android application. The file itself is a compressed collection of an AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file.

What is .dex extension ? Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped

into a single .apk file on the device. .dex files can be created by automatically translating compiled applications written in the Java programming language

What is an adb ? Android Debug Bridge, a command-line debugging application shipped with the SDK. It provides tools to browse the device, copy tools on the device, and forward ports for debugging. What is an Application ? A collection of one or more activities, services, listeners, and intent receivers. An application has a single manifest, and is compiled into a single .apk file on the device.

What is a Content Provider ? A class built on ContentProvider that handles content query strings of a specific format to return data in a specific format. See Reading and writing data to a content provider for information on using content providers.

What is a Dalvik ? The name of Androids virtual machine. The Dalvik Virtual Machine is an interpreter-only virtual machine that executes files in the Dalvik Executable (.dex) format, a format that is optimized for efficient storage and memory-mappable execution. The virtual machine is register-based, and it can run classes compiled by a Java language compiler that have been transformed into its native format using the included dx tool. The Virtual Machine runs on top of Posix-compliant operating systems, which it relies on for underlying functionality (such as threading and low level memory management). The Dalvik core class library is intended to provide a familiar development base for those used to programming with Java Standard Edition, but it is geared specifically to the needs of a small mobile device. What is DDMS ? Dalvik Debug Monitor Service, a GUI debugging application shipped with the Software Development Kit. It provides screen capture, log dump, and process examination capabilities.

What is Drawable? A compiled visual resource that can be used as a background, title, or other part of the screen. It is compiled into an android.graphics.drawable subclass.

What is an Intent? A class (Intent) that contains several fields describing what a caller would like to do. The caller sends this intent to Androids intent resolver, which looks through the intent filters of all applications to find the activity most suited to handle this intent. Intent fields include the desired action, a category, a data string, the MIME type of the data, a handling class, and other restrictions.

What is an Intent Filter ? Activities and intent receivers include one or more filters in their manifest to describe what kinds of intents or messages they can handle or want to receive. An intent filter lists a set of requirements, such as data type, action requested, and URI format, that the Intent or message must fulfill. For Activities, Android searches for the Activity with the most closely matching valid match between the Intent and the activity filter. For messages, Android will forward a message to all receivers with matching intent filters.

What is an Intent Receiver? An application class that listens for messages broadcast by calling Context.broadcastIntent What is a Layout resource? An XML file that describes the layout of an Activity screen. What is a Manifest ? An XML file associated with each Application that describes the various activies, intent filters, services, and other items that it exposes.

What is a Resource ? A user-supplied XML, bitmap, or other file, entered into an application build process, which can later be loaded from code. Android can accept resources of many types; see Resources for a full description. Application-defined resources should be stored in the res/ subfolders.

What is a Service ? A class that runs in the background to perform various persistent actions, such as playing music or monitoring network activity.

What is a Theme ? A set of properties (text size, background color, and so on) bundled together to define various default display settings. Android provides a few standard themes, listed in R.style (starting with Theme_).

What is an URIs? Android uses URI strings both for requesting data (e.g., a list of contacts) and for requesting actions (e.g., opening a Web page in a browser). Both are valid URI strings, but have different values. All requests for data must start with the string content://. Action strings are valid URIs that can be handled appropriately by applications on the device; for example, a URI starting with http:// will be handled by the browser.

Can I write code for Android using C/C++? Yes, but need to use NDK Android applications are written using the Java programming language. Android includes a

set of core libraries that provides most of the functionality available in the core libraries of the Java programminglanguage. Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included dx tool. Android only supports applications written using the Java programming language at this time.

What is an action? A description of something that an Intent sender desires. What is activity? A single screen in an application, with supporting Java code. What is intent? A class (Intent) describes what a caller desires to do. The caller sends this intent to Androids intent resolver, which finds the most suitable activity for the intent. E.g. opening a PDF file is an intent, and the Adobe Reader is the suitable activity for this intent.

How is nine-patch image different from a regular bitmap? It is a resizable bitmap resource that can be used for backgrounds or other images on the device. The NinePatch class permits drawing a bitmap in nine sections. The four corners are unscaled; the four edges are scaled in one axis, and the middle is scaled in both axes.

What languages does Android support for application development? Android applications are written using the Java programming language. What is a resource? A user-supplied XML, bitmap, or other file, injected into the application build process, which can later be loaded from code.

How will you record a phone call in Android? How to get a handle on Audio Stream for a call in Android? Permissions.PROCESS_OUTGOING_CALLS: Allows an application to monitor, modify, or abort outgoing calls.

S-ar putea să vă placă și