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.
Question : Which of these Activity class methods must be overridden when creating a Menu that is displayed when the device's Menu button is pressed?
Correct Answer : Get Lastest Questions and Answer : Explanation: Open MainActivity.java. onCreateOptionsMenu method is responsible for creating a menu. Menu object is passed to this method as a parameter. We will add our menu items into this object. The adding procedure is simple, add method is used. This method takes the text of the menu item as a parameter. Let's add 4 items
public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub
return super.onCreateOptionsMenu(menu); } onCreateOptionsMenu method returns a boolean result. True - show menu, False - do not show. So we could have made a checking of some condition, and as a result of this check do not show a menu returning False. We don't need this for now, so we delegate this choice to the method of superclass, it returns True by default.