Android Questions
Android Questions
PackageManager m =
getPackageManager();
if (!
m.hasSystemFeature(Package
Manager.FEATURE_SENSO
R_COMPASS)) {
// This device does not have
Which of the code snippets below is the a compass, turn off the
correct way to check if a Compass compass feature
Android sensor is present on the system? }
_______ provides support for Hyper
Text Transfer Protocol (HTTP) org.apache.hhttp.*
Broadcast that includes information android.intent.action.BATTER
about battery state, level, etc. is Y_LOW
Which of the following best explains the The code inflates an xml file
code above? into menu items
<?xml version="1.0" encoding="utf-8"?
>
<LinearLayout
xmlns:android="http://schemas.android.
com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name:" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" />
</LinearLayout>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Post" /> An edit text to the left of a text
</LinearLayout> view and a button beneath it.
What is potentially wrong with the
following Android code?
SensorManager m =
getSensorManager(); Sensor s = getSensor();
if (! if (!
m.hasSystemFeature(SensorM s.hasSystemFeature(Sensor.FE
anager.FEATURE_SENSOR_ ATURE_SENSOR_COMPAS
COMPASS)) { S)) {
// This device does not have // This device does not have
a compass, turn off the a compass, turn off the
compass feature compass feature
} } None of these
2
3
1