Premium

Associate Android Developer Certification Questions and Answer (Dumps and Practice Questions)



Question : Javascript is enabled by default in a WebView

 : Javascript is enabled by default in a WebView
1. True
2. False

Correct Answer : 2
Explanation: If the web page you plan to load in your WebView use JavaScript, you must enable JavaScript for your WebView. Once JavaScript is enabled, you can also create interfaces between your application code and your JavaScript code.




Question : How to enable JavaScript in WebView?

 : How to enable JavaScript in WebView?
1. myWebView. setJavaScriptEnabled(true);

2. myWebView.getJavaScriptSettings.setEnabled(true)

3. myWebView.getSettings().setJavaScriptEnabled(true);

4. Java script is always enabled in WebView

Correct Answer : 3
Explanation: Using JavaScript in WebView
If the web page you plan to load in your WebView use JavaScript, you must enable JavaScript for your WebView. Once JavaScript is enabled, you can also create interfaces between your application code and your JavaScript code.

Enabling JavaScript

JavaScript is disabled in a WebView by default. You can enable it through the WebSettings attached to your WebView. You can retrieve WebSettings with getSettings(), then enable JavaScript with setJavaScriptEnabled().

For example:

WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
WebSettings provides access to a variety of other settings that you might find useful. For example, if you're developing a web application that's designed specifically for the WebView in your Android application, then you can define a custom user agent string with setUserAgentString(), then query the custom user agent in your web page to verify that the client requesting your web page is actually your Android application.




Question : What two methods you have to override when implementing Android context menus?

 : What two methods you have to override when implementing Android context menus?
1. onCreateOptionsMenu, onCreateContextMenu

2. onCreateContextMenu, onContextItemSelected

3. onCreateOptionsMenu, onOptionsItemSelected

4. onCreateOptionsMenu, onContextItemSelected

Correct Answer : 2
Explanation: onCreateContextMenu (ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
This method is triggered when the screen is long pressed and context menu view is being built
menu - The actual context menu being built, using which we can set its properties.

public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("Context Menu");
menu.add(0, v.getId(), 0, "Action 1");
menu.add(0, v.getId(), 0, "Action 2");
menu.add(0, v.getId(), 0, "Action 3");
}

onContextItemSelected(MenuItem item)
This is called whenever an item in the context menu is selected and the interface MenuItem provides necessary details on the selected item. Through which we can write our own functionality to be perform based on item selection.


Related Questions


Question : Which code acquires a MediaPlayer class instance?

 : Which code acquires a MediaPlayer class instance?
1. MediaPlayer.create(this, R.raw.music);

2. newMediaPlayer(this, R.raw.music);

3. Access Mostly Uused Products by 50000+ Subscribers

4. MediaPlayer.newInstancefthis, R.raw.music),


Question : Which of the following is not a ContentProvider provided natively by Android?
 : Which of the following is not a ContentProvider provided natively by Android?
1. The contacts list

2. The telephone log

3. Access Mostly Uused Products by 50000+ Subscribers

4. The application list


Question : When creating a file using android.content.Context.openFileOutput("test.txt", ), where is the file created?

 : When creating a file using android.content.Context.openFileOutput(
1. /data/app//files

2. /data/data//files

3. Access Mostly Uused Products by 50000+ Subscribers

4. /system/data//files


Question : Which of the following is incorrect about the LogCat tool?

 : Which of the following is incorrect about the LogCat tool?
1. A LogCat view is available as part of the ADT plugin of Eclipse

2. You can create a log in your application using Log.v(String, String)

3. Access Mostly Uused Products by 50000+ Subscribers

4. Only one of your application can create log entries, and it should be component class (Activity, Service,...etc)


Question : Which of the following information is not included in the Manifest file?

 : Which of the following information is not included in the Manifest file?
1. The activities contained in the application

2. The permissions required by the application

3. Access Mostly Uused Products by 50000+ Subscribers

4. The handset model compatible with your application.


Question : Which method should you use to start a sub-activity?

 : Which method should you use to start a sub-activity?
1. startActivity(Intent intent)

2. startActivityForResult(Intent intent)

3. Access Mostly Uused Products by 50000+ Subscribers

4. startSubActivity(Intent intent)