Select chapter



basics (6.papers)
activities (5.papers)
services (2.papers)
threads (2.papers)
receivers (1.papers)
advanced android (2.papers)
SQLite database (1.papers)
adapters (1.papers)
adb and ddms (1.papers)
widgets (1.papers)
fragments (1.papers)
UI (1.papers)
Hide

Sponsored Links


  

android interview questions and answers

1
How to write intent to send email in android?
  1. Intent email = new Intent(Intent.ACTION_SEND);
    email.setType("message/rfc822");
    email.putExtra(Intent.EXTRA_EMAIL, new String[] {"info@skillgun.com"});
    email.putExtra(Intent.EXTRA_SUBJECT, "Hi, This is a test mail..");  
    startActivity(Intent.createChooser(email, "Choose an Email Client"));
  2. Intent email = new Intent(Intent.ACTION_EMAIL);
    email.setType("message/rfc822");
    email.putExtra(Intent.EMAIL, new String[] {"info@skillgun.com"});
    email.putExtra(Intent.SUBJECT, "Hi, This is a test mail..");  
    startActivity(Intent.createChooser(email, "Choose an Email Client"));
  3. Intent i = new Intent(Intent.ACTION_SEND);
    i.setType("message/rfc822");
    i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"info@skillgun.com"});
    i.putExtra(Intent.EXTRA_SUBJECT, "test mail");
    i.putExtra(Intent.EXTRA_TEXT   , "Did you get this mail? if so please reply back");
    startActivity(Intent.createChooser(i, "Send mail..."));
  4. both option 1 and option 3 are correct
Show Answer
Share Facebook gmail Twitter
2
What are the functionalities of HTTPClient interface in android?
  1. connection management
  2. authentication management
  3. cookies management
  4. all of the above
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
4
To use HTTPClient, which permission is required in an android application?
  1. android.permission.INTERNET
  2. android.permission.FINE_LOCATION
  3. android.permission.READ_CONTACTS
  4. All of the above
Show Answer
Share Facebook gmail Twitter
5
If internet permission is not taken to use HTTP Client, then what will happen?
  1. It will throw run time exception, i.e IOException
  2. It will throw compile time exception, i.e IOException
  3. It will throw run time exception, i.e CLientProtocolException.
  4. It will not compile only.
Show Answer
Share Facebook gmail Twitter
6
If the URL given in HTTPGet request is not valid then what is the exception that will be thrown, in an android application?
  1. It will throw run time exception, i.e IOException
  2. It will throw compile time exception, i.e IOException
  3. It will throw run time exception, i.e CLientProtocolException.
  4. It will not compile only.
Show Answer
Share Facebook gmail Twitter
7
What is the use of httpclient class?
  1. can execute httprequests (get/post).
  2. can execute httprequests(get/post) and returns response from server
Show Answer
Share Facebook gmail Twitter
8
In RESTFUL API What is the difference between httpget() and httppost() methods in android, when to use what?
  1. httpget() - use it when we want to get some information from an URL.
  2. option 1 is true & httppost() - use it when we want to post some infromation from mobile to a server mentioned by URL
  3. httpget() - use it when we want to get some information from a mobile to a server mentioned by an URL.
  4. option 3 is true & , httppost() - use it when we want to post some information from a server mentioned by an URL to mobile.
Show Answer
Share Facebook gmail Twitter
9
What does httpclient.execute() return?
  1. HttpResponse
  2. HttpEntity
  3. Boolean - success or failure
  4. void
Show Answer
Share Facebook gmail Twitter
10
What is the package name of JSONObject, JSONArray.
  1. com.android.json
  2. org.json
  3. net.json
  4. com.json
Show Answer
Share Facebook gmail Twitter
11
What is the package name of HTTPClient?
  1. org.apache.http.client
  2. com.android.http.client
  3. org.http
  4. com.http.client
Show Answer
Share Facebook gmail Twitter
12
How to read data from an xml file in xml folder of resources, in Android application?
  1. Use XMLResource parser to read the resource file, and parse it.
  2. Use XMLPullParser to read the resource file, and parse it.
  3. We can either use option 1 or option 2 to read xml resource files.
  4. Use layoutinflater to inflate xml file and then read the data.
Show Answer
Share Facebook gmail Twitter
13
Which of the below are not an event of XMLPullparser?
  1. XMLPullParser.START_DOCUMENT
  2. XMLPullParser.START_TAG
  3. XMLPullParser.START_TEXT
  4. XMLPullParser.END_TAG
Show Answer
Share Facebook gmail Twitter
14
In which library MapView class is located?
  1. android.location
  2. android.hardware
  3. com.google.android.maps
  4. none of the above.
Show Answer
Share Facebook gmail Twitter
15
If I want to use MapView, what all the steps I have to follow.
  1. Use MapActivity with MapView and use library "com.google.android.maps". App should have internet permission as well.
  2. along with option 1 , we have to register our application with Google maps service, by providing md5 finger print of  the debug certificate of the application.
  3. along with option 1 , we have to register our application with Google maps service, by providing md5 finger print of  the final digital certificate with which application will be signed.
  4. No need to use maps library, it is part of android framework.
Show Answer
Share Facebook gmail Twitter
16
How the result will be sent from a webserver to phone, for a HTTPRequest sent from an android application to a webserver?
  1. Result will be sent in the form of HTTPEntity, which is embedded as body in HTTPResponse.
  2. HTTPEntity will contain the encoded data that is coming from server to client.
  3. Option 2 is true, but option 1 is false. Result will be sent in the form of HTTPResponse, which is embedded as body in HTTPEntity..
  4. Both option 1 and 2 are right.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
19
JSON : assume that str is string holding below json string, then which of the below code will fetch mobile no of "Satish"?

{
    "contacts": [
        {
                "id": "p001",
                "name": "Satish",
                "email": "satish@gmail.com",
                "address": "Bangalore",
                "gender" : "male",
                "phone": {
                    "mobile": "+91 9740000000",
                    "home": "080 4164536x",
                    "office": "080 4144232x"
                }
        }
     ]
}
  1. JSONObject root = new JSONObject(str);
    JSONArray arr = root.getJSONArray("contacts");
    String ph = arr.getJSONObject(0).getString("mobile");
  2. JSONArray root = new JSONArray (str);
    String ph = arr.getJSONObject(0).getJSONObject("phone").getString("mobile");
  3. JSONObject root = new JSONObject(str);
    JSONArray arr = root.getJSONArray("contacts");
    String ph = arr.getJSONObject(0).getJSONObject("phone").getString("mobile");
  4. JSONObject root = new JSONObject(str);
    JSONObject obj= root.JSONObject("contacts");
    String ph = obj.getJSONObject("phone").getString("mobile");
Show Answer
Share Facebook gmail Twitter
20
JSON : Assume that below json is in string str. How to fetch username of this person?

{
   "id": "676248615",
   "name": "Satish Reddy",
   "first_name": "Satish",
   "last_name": "Reddy",
   "link": "http://www.facebook.com/satish.ice",
   "username": "satish.ice",
   "locale": "en_US"
}
  1. JSONObject root = getJSONObject(str);
    String name = root.getString("username");
  2. JSONObject root = new JSONObject(str);
    String name = root.getString("username");
  3. Since there is no name to this JSON object, it is not possible to fetch data from this kind of JSON strings. These are called as anonymous JSON Objects which don't have name. This is used for security purposes.
  4. none of the above are true.
Show Answer
Share Facebook gmail Twitter
Read more papers :