Free AND-401 Exam Braindumps (page: 13)

Page 12 of 58

Which of the following is NOT true about onMeasure() method of class View?

  1. It measures the view and its contents to determine the measured width and height.
  2. It is invoked by measure().
  3. When overriding this method, a developer must call setMeasuredDimension().
  4. It takes three parameters: the height, width, and the depth of the view.

Answer(s): D

Explanation:

Syntax: protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
onMeasure() measures the view and its content to determine the measured width and the measured height. This method is invoked by measure(int, int) and should be overridden by subclasses to provide accurate and efficient measurement of their contents.


Reference:

http://developer.android.com/reference/android/view/View.html#onMeasure(int, int)



Which of the following Activity life-cycle methods is invoked when a dialog is shown?

  1. onPause()
  2. onCreate()
  3. onStop()
  4. onDestroy()

Answer(s): A

Explanation:

onPause() is where you deal with the user leaving your activity.


Reference:

http://developer.android.com/reference/android/app/Activity.html



Which of the following is NOT true about class DefaultHttpClient?

  1. It supports HTTPS.
  2. It supports streaming uploads and downloads.
  3. It is only supported on Android versions 2.2 and older.
  4. It is Andriod’s default implementation of an HTTP client.

Answer(s): C

Explanation:

Android 6.0 release removes support for the Apache HTTP client. If your app is using this client and targets Android 2.3 (API level 9) or higher, use the HttpURLConnection class instead.


Reference:

http://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-httpclient



Which of the following is NOT true about the SharedPreferences interface?

  1. The data it saves is persistent even if application is killed.
  2. It only saves primitive data in key-value pairs.
  3. Modifications to preferences saved should go through class SharedPreferences.Editor
  4. It can save any data type in key-value pairs.

Answer(s): D

Explanation:

SharedPreferences class is an interface for accessing and modifying preference data returned by getSharedPreferences(String, int). For any particular set of preferences, there is a single instance of this class that all clients share. Modifications to the preferences must go through an SharedPreferences.Editor object to ensure the preference values remain in a consistent state and control when they are committed to storage.
Objects that are returned from the various get methods must be treated as immutable by the application.


Reference:

http://developer.android.com/reference/android/content/SharedPreferences.html






Post your Comments and Discuss Android AND-401 exam with other Community members:

AND-401 Exam Discussions & Posts