Question : Consider the following code snippet: String[] result_columns = new String[] {KEY_ID, COL1, COL2}; Cursor allRows = myDatabase.query(true, DATABASE_TABLE, result_columns, null, null, null, null, null, null); Which of the following prints out the values of COL1 column correctly if the result is not empty?
1. if (cursor.moveToFirst()) { do { System.out.println(cursor.getString(1)); } while (cursor.moveToNext()); }
2. do { System.out.println(cursor.getString(0)); } while (cursor.moveToNext());
4. When the Activity returns from an onPause(), it sometimes can execute from onCreate().
Correct Answer : Get Lastest Questions and Answer : Explanation: The Activity class defines the following call backs i.e. events. You don't need to implement all the callbacks methods. However, it's important that you understand each one and implement those that ensure your app behaves the way users expect.
Callback Description onCreate() This is the first callback and called when the activity is first created. onStart() This callback is called when the activity becomes visible to the user. onResume() This is called when the user starts interacting with the application. onPause() The paused activity does not receive user input and cannot execute any code and called when the current activity is being paused and the previous activity is being resumed. onStop() This callback is called when the activity is no longer visible. onDestroy() This callback is called before the activity is destroyed by the system. onRestart() This callback is called when the activity restarts after stopping it.
1. In order to display a Ul defined in the XML layout file "main.xml", call the setContentView method of theActivity with the parameter string "main.xml".
2. There is no distinction between implementation of the layout definition by code, or by XML layout file.
3. In an Eclipse project using the ADT plugin, the XML layout file is found in the /res/layout directory.
4. Layout information written in the XML layout file will be converted into code by the Android platform whenthe screen is displayed.