Free AND-401 Exam Braindumps (page: 25)

Page 24 of 58

Which of the following sets the entire Activity window as a WebView?

  1. WebView webview = new WebView(this);
    webview.setAsWindow;
  2. setContentView(R.layout.webview);
  3. WebView webview = new WebView(this);
    setContentView(webview);
  4. setContentView(“http://www.androidatc.com”);

Answer(s): C



Consider the following the code:
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.game_menu, menu);
return true;
}
Which of the following is true about the code above?

  1. The code is auto generated and should not be edited
  2. This method handles clicks and assign actions to menu items
  3. This function inflates an XML file in the res/menu folder into menu items
  4. This method inflates an XML file in the res/layout folder into layout.

Answer(s): C



Consider the following AndroidManifest.xml file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mkyong.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.WebActivity " />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".WebViewActivity"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Supposing the application connects to the internet at startup, which of the following is true?

  1. The application throws an exception indicating it does not have permission to access the URL
  2. The application will work as intended
  3. The application won’t compile
  4. The application throws a java.lang.SecurityException

Answer(s): A

Explanation:

The program will compile, but then it will not be able to access the internet, as it does not have usespermission=” android.permission.INTERNET”



Which of the following is not true about using a WebView in your application?

  1. You can retrieve WebSettings with getSettings(), then enable/disable JavaScript
  2. You need to add permission “android.permission.ACCESS_NETWORK_STATE”
  3. You use loadURL to load a webpage
  4. You use loadData to load HTML

Answer(s): B

Explanation:

In order for your Activity to access the Internet and load web pages in a WebView, you must add the INTERNET permissions to your Android Manifest file:
<uses-permission android:name="android.permission.INTERNET" />


Reference:

http://developer.android.com/reference/android/webkit/WebView.html






Post your Comments and Discuss Android AND-401 exam with other Community members: