WorksheetsAndroid Associate Developer (TUGAS 1-RP)
Total questions: 15
Worksheet time: 14mins
What Activity method you use to retrieve a reference to an Android view by using the id attribute of a resource XML?
findViewByReference(int id)
retrieveResourceById(int id)
findViewById(int id)
findViewById(String id)
During an Activity life-cycle, what is the first callback method invoked by the system?
onCreate()
onStart()
onStop()
onRestore()
What does the following line of code achieve?
Intent intent = new Intent(FirstActivity.this, SecondActivity.class );
Starts an activity
Creates an implicit Intent.
Creates a hidden Intent.
Create an explicit Intent.
Which of the following is NOT a valid usage for Intents?
Activate a SQLite DB Connection.
Activate a Broadcast receiver.
Activate a Service.
Activate and Activity.
What is the parent class of all Activity widgets?
Layout
ViewGroup
View
Widget
What does this code do?
Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(android.net.Uri.parse("http://www.androidatc.com")); startActivity(intent);
Starts an activity using an implicit intent.
Sends results to another activity
Starts a sub-activity.
Starts a service
Which method should you use to start a sub-activity?
startSubActivity(Intent intent)
startService(Intent intent)
startActivity(Intent intent)
startActivityForResult(Intent intent)
What is not true about the AndroidManifest.xml file?
It declares the views used within the application.
It declares user permissions the application requires.
It declares hardware and software features used within the application.
It declares application components.
If your application is throwing exception android.content.ActivityNotFoundException, which of the following could resolve the problem?
Add the activity to AndroidManifest.xml
Create the activity layout
Create a new sub-class of the View class
Create a new broadcast receiver
Consider the following code:
Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(android.net.Uri.parse("http://www.androidatc.com")); startActivity(intent);
Which of the following is correct about the code above?
It will not compile without adding the INTERNET permission the Manifest file
It starts any activity in the application that has a WebView in its layout
When it is executed, the system starts an intent resolution process to start the right Activity.
It sends a result to a new Activity in a Bundle
What is the name of the class used by Intent to store additional information?
Parcelable
Extra
DataStore
Bundle
What does the Android project folder “res/” contain?
Resource files
Java source code
Java Activity classes
Libraries
Which of the following methods is called in an Activity when another activity gets into the foreground?
onDestroy()
onPause()
onStop()
onExit()
Which of the following is incorrect about intents?
They can be used to start an Activity
They can be used to start a service
They can be used to start database insertion
They can be used to start a dialog-themed activity
Which of the following lines of code is used to pass a value to the next activity?
Intent i = new Intent(this,newActivity);
i.addExtra(“test”);
startActivity(i);
Intent i = new Intent(this,newActivity);
i.putValue(“value1”,“test”);
startActivity(i);
Intent i = new Intent(this,newActivity);
i.putValue(“test”);
startActivity(i);
Intent i = new Intent(this,newActivity);
i.putExtra(“value1”,“test”);
startActivity(i);
