Weekend Sale - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: sntaclus

Working with Custom View. Once you define the custom attributes, you can use them in layout XML files just like built-in attributes. The only difference is that your custom attributes belong to a different namespace. Instead of belonging to the http://schemas.android.com/apk/res/android namespace, they belong to:

A.

http://schemas.android.com/apk/res/[your package name]

B.

http://schemas.android.com/apk/[your package name]

C.

http://schemas.android.com/[your package name]

Assume that an app includes a default set of graphics and two other sets of graphics, each optimized for a different device setup:

res/drawable/

Contains default graphics. res/drawable-small-land-stylus/

Contains graphics optimized for use with a device that expects input from a stylus and has a QVGA low- density screen in landscape orientation.

res/drawable-ja/

Contains graphics optimized for use with Japanese.

What happens if the app runs on a device that is configured to use Japanese and, at the same time, the device happens to be one that expects input from a stylus and has a QVGA low-density screen in landscape orientation?

A.

Android loads graphics from res/drawable/

B.

Android loads graphics from res/drawable-small-land-stylus/

C.

Android loads graphics from res/drawable-ja/

What do you want from Room when you create a DAO method and annotate it with @Update?

Example:

@Dao

public interface MyDao {

@Update

public void updateUsers(User... users);

}

A.

Room generates an implementation that inserts all parameters into the database in a single transaction.

B.

Room modifies a set of entities, given as parameters, in the database. It uses a query that matches against the primary key of each entity.

C.

Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.

For example, we have a BufferedReader reader, associated with the json file through

InputStreamReader. To get a file data we can do this:

A.

String line; try {

while ((line = reader.readLine()) != null) { builder.append(line);

}

JSONObject json = new JSONObject(builder.toString());

return json;

} catch (IOException | JSONException exception) {

exception.printStackTrace();

}

B.

JSONObject line; try {

while ((line = reader.readJSONObject ()) != null) { builder.append(line);

}

JSONObject json = new JSONObject(builder.toString());

return json;

} catch (IOException | JSONException exception) {

exception.printStackTrace();

}

C.

String line; try {

while ((line = reader.readLine()) != null) { builder.append(line);

}

JSONObject json = new JSONObject(builder.toString());

return json;

} catch (RuntimeException|ArrayIndexOutOfBoundsException exception) {

exception.printStackTrace();

}

For example, our preferences.xml file was added by addPreferencesFromResource (R.xml.preferences). Our preferences.xml file contains such item:

android:title="@string/pref_notification_title" android:summary="@string/pref_notification_summary" android:defaultValue="@bool/pref_notification_default_value" app:iconSpaceReserved="false"/>

In our Fragment, we can dynamically get current notification preference value in this way:

A.

boolean isNotificationOn = PreferenceManager.getDefaultSharedPreferences(getContext ()).getBoolean(

getContext().getString(R.string.pref_notification_key), getContext().getResources().getBoolean(R.bool.pref_notification_default_value)

);

B.

boolean isNotificationOn = PreferenceManager.getSharedPreferences(getContext ()).getBoolean(

getContext().getString(R.string.pref_notification_default_value), getContext().getString(R.string.pref_notification_key)

);

C.

boolean isNotificationOn = PreferenceManager.getSharedPreferences(getContext ()).getBoolean(

getContext().getResources().getBoolean(R.bool.pref_notification_default_value), getContext().getString(R.string.pref_notification_key)

);

Choose the most correct statement.

A.

Android is a closed source, Linux-based software stack created for a wide array of devices and form factors.

B.

Android is a closed source, Windows-based software stack created for a wide array of devices and form factors.

C.

Android is an open source, Linux-based software stack created for a wide array of devices and form factors.

D.

Android is an open source software stack created for a highly limited array of devices and form factors.

Custom duration in milliseconds as a parameter for the setDuration method is available when you are working with:

A.

Toast

B.

Snackbar

C.

for none of them

D.

for both of them