Javascript is enabled by default in a WebView
Answer(s): B
If the web page you plan to load in your WebView use JavaScript, you must enable JavaScript for your WebView.
http://developer.android.com/guide/webapps/webview.html
How to enable JavaScript in WebView?
Answer(s): C
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);
What two methods you have to override when implementing Android context menus?
Need to create context menu. For this need to override this method:@Overridepublic void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo);menu.setHeaderTitle("My Context Menu"); menu.add(0, NEW_MENU_ITEM, 0, "new"); menu.add(0, SAVE_MENU_ITEM, 1, "save");}And last one need to handle menu clicks:@Overridepublic boolean onContextItemSelected(MenuItem item) { switch (item.getItemId()) {case NEW_MENU_ITEM:doSomething(); break;case SAVE_MENU_ITEM:doSomething(); break;}return super.onContextItemSelected(item);}
https://thedevelopersinfo.wordpress.com/2009/11/06/using-context-menus-in-android/
What two methods you have to override when implementing Android option menus?
To specify the options menu for an activity, override onCreateOptionsMenu().When the user selects an item from the options menu (including action items in the app bar), the system calls your activity's onOptionsItemSelected() method. This method passes the MenuItem selected. You can identify the item by calling getItemId(), which returns the unique ID for the menu item (defined by the android:id attribute in the menu resource or with an integer given to the add() method). You can match this ID against known menu items to perform the appropriate action.For example:@Override public boolean onOptionsItemSelected(MenuItem item) { Etc.
http://developer.android.com/guide/topics/ui/menus.html
Post your Comments and Discuss Android AND-401 exam with other Community members:
To protect our content from bots for real learners like you, we ask you to register for free. Sign in or sign up now to continue with the AND-401 material!