For example, our preferences.xmlfile was added by addPreferencesFromResource(R.xml.preferences). Our preferences.xmlfile contains such item:
In our Fragment, we can dynamically get current notification preference value in this way:
A. val isNotificationOn = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context!!.getString(R.string.pref_notification_key),context!!.resources.getBoolean(R.bool.pref_notification_default_value)
)
B. val isNotificationOn = PreferenceManager.getSharedPreferences(context).getBoolean(context!!.getString(R.string.pref_notification_default_value),context!!.getString(R.string.pref_notification_key),
)
C. val isNotificationOn = PreferenceManager.getSharedPreferences(context).getBoolean(context!!.resources.getBoolean(R.bool.pref_notification_default_value),context!!.getString(R.string.pref_notification_key)
)
When your code execution reaches the breakpoint, Android Studio pauses execution of your app. You can then use the tools in the Debugger tab to identify the state of the app. With Evaluate Expression
you can
A. examine the object tree for a variable; expand it in the Variables view
B. evaluate an expression at the current execution point
C. advance to the next line in the code (without entering a method)
D. advance to the first line inside a method call
E. advance to the next line outside the current method
F. continue running the app normally
By executing an allowMainThreadQueries() method to the room database builder RoomDatabase.Builder, we can:
A. set the database factory
B. handle database first time creation
C. handle database opening
D. disable the main thread query check for Room
The easiest way of adding menu items (to specify the options menu for an activity) is inflating an XML file into the Menu via MenuInflater. With menu_main.xml we can do it in this way:
A. @Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
B. @Override
public boolean onOptionsItemSelected(MenuItem item) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return super.onOptionsItemSelected(item);
}
C. @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.menu.menu_main);
}
To build a debug APK, you can open a command line and navigate to the root of your project directory. To initiate a debug build, invoke the assembleDebug task:
gradlew assembleDebug
This creates an APK named [module_name]-debug.apk in [project_name]/[module_name]/build/outputs/apk/
Select correct statements about generated file. (Choose all that apply.)
A. The file is already signed with the debug key
B. The file is already aligned with zipalign
C. You can immediately install this file on a device.
Building your app from the command line, if you have a "demo" product flavor, then you can build the debug version with the command:
A. gradlew assembleDemoDebug
B. gradlew installDemoDebug
C. both variants are correct.
In application theme style, flag windowActionBar (
A. whether the given application component is available to other applications.
B. whether action modes should overlay window content when there is not reserved space for their UI (such as an Action Bar).
C. whether this window's Action Bar should overlay application content.
D. whether this window should have an Action Bar in place of the usual title bar.
In application theme style, value statusBarColor (
A. Color of text (usually same as colorForeground).
B. Shows a thin line of the specified color between the navigation bar and the app content. For this to take effect, the window must be drawing the system bar backgrounds with
C. attr.windowDrawsSystemBarBackgrounds and the navigation bar must not have been requested to be translucent with R.attr.windowTranslucentNavigation. Corresponds to Window.setNavigationBarDividerColor(int).
D. The color for the status bar. If the color is not opaque, consider setting View.SYSTEM_UI_FLAG_LAYOUT_STABLE and View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN. For this to take effect, the window must be drawing the system bar backgrounds with
E. attr.windowDrawsSystemBarBackgrounds and the status bar must not have been requested to be translucent with R.attr.windowTranslucentStatus. Corresponds to Window.setStatusBarColor(int).
F. The color for the navigation bar. If the color is not opaque, consider setting View.SYSTEM_UI_FLAG_LAYOUT_STABLE and View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION. For this to take effect, the window must be drawing the system bar backgrounds with R.attr.windowDrawsSystemBarBackgrounds and the navigation bar must not have been
requested to be translucent with
G. attr.windowTranslucentNavigation. Corresponds to Window.setNavigationBarColor(int).