Correct Answer : Get Lastest Questions and Answer : Explanation: Although you can instantiate new Preference objects at runtime, you should define your list of settings in XML with a hierarchy of Preference objects. Using an XML file to define your collection of settings is preferred because the file provides an easy-to-read structure that's simple to update. Also, your app's settings are generally pre-determined, although you can still modify the collection at runtime.
Each Preference subclass can be declared with an XML element that matches the class name, such as .
You must save the XML file in the res/xml/ directory. Although you can name the file anything you want, it's traditionally named preferences.xml. You usually need only one file, because branches in the hierarchy (that open their own list of settings) are declared using nested instances of PreferenceScreen.
Note: If you want to create a multi-pane layout for your settings, then you need separate XML files for each fragment.
The root node for the XML file must be a element. Within this element is where you add each Preference. Each child you add within the element appears as a single item in the list of settings.
Question : Which of these is the incorrect explanation of the Java Native Interface(JNI)?
1. JNI does not provide garbage collection on the native side, outside the memory resources of the Java Virtual Machine.
2. Even if native code is used with JNI, it does not necessarily mean an improvement in the application processing speed.
4. Header files generated on the Java side are included and implemented in the native (C/C++) side source code.
Correct Answer : Get Lastest Questions and Answer : Explanation: JNI is the Java Native Interface. It defines a way for managed code (written in the Java programming language) to interact with native code (written in C/C++). It's vendor-neutral, has support for loading code from dynamic shared libraries, and while cumbersome at times is reasonably efficient. JNI defines two key data structures, "JavaVM" and "JNIEnv". Both of these are essentially pointers to pointers to function tables. (In the C++ version, they're classes with a pointer to a function table and a member function for each JNI function that indirects through the table.) The JavaVM provides the "invocation interface" functions, which allow you to create and destroy a JavaVM. In theory you can have multiple JavaVMs per process, but Android only allows one.
The JNIEnv provides most of the JNI functions. Your native functions all receive a JNIEnv as the first argument.
The JNIEnv is used for thread-local storage. For this reason, you cannot share a JNIEnv between threads. If a piece of code has no other way to get its JNIEnv, you should share the JavaVM, and use GetEnv to discover the thread's JNIEnv. (Assuming it has one; see AttachCurrentThread below.)
The C declarations of JNIEnv and JavaVM are different from the C++ declarations. The "jni.h" include file provides different typedefs depending on whether it's included into C or C++. For this reason it's a bad idea to include JNIEnv arguments in header files included by both languages. (Put another way: if your header file requires #ifdef __cplusplus, you may have to do some extra work if anything in that header refers to JNIEnv.)
The Microsoft Java VM supports two native method interfaces. At the low level, it provides an efficient Raw Native Interface (RNI). The RNI offers a high degree of source-level backward compatibility with the JDK's native method interface, although it has one major difference. Instead of relying on conservative garbage collection, the native code must use RNI functions to interact explicitly with the garbage collector.
At a higher level, Microsoft's Java/COM interface offers a language-independent standard binary interface to the Java VM. Java code can use a COM object as if it were a Java object. A Java class can also be exposed to the rest of the system as a COM class.
Question : Which is the correct explanation of ListView? A. It is necessary to use ListView as a set with ListActivity. B. There is a function in ListView which displays a message when there is no information to be displayed. C. When displaying an array using an Adapter class in ListView, it is necessary to convert it into a Collection class. D. ListView has a function to display a list of uniquely defined Views other than TextView.
1. It is necessary to use ListView as a set with ListActivity.
2. There is a function in ListView which displays a message when there is no information to be displayed.
4. ListView has a function to display a list of uniquely defined Views other than TextView.
Correct Answer : Get Lastest Questions and Answer : Explanation: ListView is a view group that displays a list of scrollable items. The list items are automatically inserted to the list using an Adapter that pulls content from a source such as an array or database query and converts each item result into a view that's placed into the list.
Android provides the ListView and the ExpandableListView classes which is capable of displaying a scrollable list of items. The ExpandableListView class supports a grouping of items.
The input to the list (items in the list) can be arbitrary Java objects. The adapter extracts the correct data from the data object and assigns this data to the views in the row of the ListView.
These items are typically called the data model of the list. An adapter can receive data as input. An adapter manages the data model and adapts it to the individual entries in the widget. An adapter extends the BaseAdapter class.
Every line in the widget displaying the data consists of a layout which can be as complex as you want.