Premium

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



Question : Which of the following WebView methods allows you to manually load custom HTML markup?

 : Which of the following WebView methods allows you to manually load custom HTML markup?
1. loadData

2. loadHTML

3. loadCustomData

4. loadCustomHTML

Correct Answer : 1
Explanation: Loads the given data into this WebView using a 'data' scheme URL.

Note that JavaScript's same origin policy means that script running in a page loaded using this method will be unable to access content loaded using any scheme other than 'data', including 'http(s)'. To avoid this restriction, use loadDataWithBaseURL() with an appropriate base URL.

The encoding parameter specifies whether the data is base64 or URL encoded. If the data is base64 encoded, the value of the encoding parameter must be 'base64'. For all other values of the parameter, including null, it is assumed that the data uses ASCII encoding for octets inside the range of safe URL characters and use the standard %xx hex encoding of URLs for octets outside that range. For example, '#', '%', '\', '?' should be replaced by %23, %25, %27, %3f respectively.

The 'data' scheme URL formed by this method uses the default US-ASCII charset. If you need need to set a different charset, you should form a 'data' scheme URL which explicitly specifies a charset parameter in the mediatype portion of the URL and call loadUrl(String) instead. Note that the charset obtained from the mediatype portion of a data URL always overrides that specified in the HTML or XML document itself.

Parameters
data a String of data in the given encoding
mimeType the MIME type of the data, e.g. 'text/html'
encoding the encoding of the data
Use this Html_value in this way:

String html_value = "Lorem Ipsum

About us

Lorem Ipsum is simply dummy text .

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text

";
this is used into webview then only it will work because your html tag was not properly closed:

WebView browser = (WebView) findViewById(R.id.sample);
browser.getSettings().setJavaScriptEnabled(true);
browser.loadData(html_value, "text/html", "UTF-8");




Question : Which of the following is the base class of all UI components?

 : Which of the following is the base class of all UI components?
1. ListView

2. Layout

3. View

4. ViewGroup

Correct Answer : 3
Explanation: ListView is a view group that displays a list of scrollable items. The list items are automatically inserted to the list using an Adapter that pulls content from a source such as an array or database query and converts each item result into a view that's placed into the list.




Question : Which of the following is true about object arrayAdapter declared in the code below?

String[] items = {"Item 1","Item 2","Item 3"};
ArrayAdapter arrayAdapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1, items);
listView.setAdapter(arrayAdapter);

 : Which of the following is true about object arrayAdapter declared in the code below?
1. It creates a TextView for each String in array items.

2. It creates Buttons for each String in array items.

3. It creates four views for listView.

4. It replaces the layout of the activity with three consecutive TextView items

Correct Answer : 1
Explanation: A concrete BaseAdapter that is backed by an array of arbitrary objects. By default this class expects that the provided resource id references a single TextView. If you want to use a more complex layout, use the constructors that also takes a field id. That field id should reference a TextView in the larger layout resource.

However the TextView is referenced, it will be filled with the toString() of each object in the array. You can add lists or arrays of custom objects. Override the toString() method of your objects to determine what text will be displayed for the item in the list.

To use something other than TextViews for the array display, for instance, ImageViews, or to have some of data besides toString() results fill the views, override getView(int, View, ViewGroup) to return the type of view you want.


Related Questions


Question : Which of the following methods is called in an Activity when another activity gets into the foreground?

 : Which of the following methods is called in an Activity when another activity gets into the foreground?
1. onStop()

2. onPause()

3. Access Mostly Uused Products by 50000+ Subscribers

4. onExit()


Question : Which of the following attributes is used to set an activity screen to landscape orientation?


 : Which of the following attributes is used to set an activity screen to landscape orientation?
1. screenorientation = landscape

2. screenOrientation="landscape"

3. Access Mostly Uused Products by 50000+ Subscribers

4. android:screenOrientation="landscape"



Question : What is not true about the AndroidManifest.xml file?

 : What is not true about the AndroidManifest.xml file?
1. It declares the views used within the application

2. It declares user permissions the application requires

3. Access Mostly Uused Products by 50000+ Subscribers

4. It declares hardware and software features used within the application


Question : If your application is throwing exception android.content.ActivityNotFoundException, how to fix it?

 : If your application is throwing exception android.content.ActivityNotFoundException, how to fix it?
1. Create a new activity Java sub-class.

2. Rename your activity

3. Access Mostly Uused Products by 50000+ Subscribers

4. Add the activity to the AndroidManifest


Question : 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?

 : Consider the following code:
1. It sends a result to a new Activity in a Bundle.

2. It will not compile without adding the INTERNET permission the Manifest file.

3. Access Mostly Uused Products by 50000+ Subscribers

4. When it is executed, the system starts an intent resolution process to start the right Activity.


Question : Which of the following is not true about tag in AndroidManifest file?

 : Which of the following is not true about <activity> tag in AndroidManifest file?
1. Declares an activity that implements part of the application's visual user interface

2. Contained in tag.

3. Access Mostly Uused Products by 50000+ Subscribers

4. Has an attribute that specifies the name of the Activity sub-class that implements the activity