Create a layout that displays the latitude, longitude, and accuracy for the netw
ID: 3853576 • Letter: C
Question
Create a layout that displays the latitude, longitude, and accuracy for the network sensor and for the GPS sensor. Add a listener for each and have it display its reported location in the appropriate onscreen widget. Run it on a device. Walk around with the app open to this screen and observe the differences. Modify the layout in Exercise 1 to have a third set of latitude, longitude, and accuracy labeled best location. Code a method to test for the best location and put the values in these widgets. Run the app and again observe the results. Modify the markers on the map to use a custom icon. You can download and use an open source graphics program such as Gimp to create your icon. You may have to work with the icon size to get it to display in a reasonable manner on the screen.Explanation / Answer
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#89b" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="18dp"
android:layout_marginTop="16dp"
android:text="Longitude:" />
<TextView
android:id="@+id/lng"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_marginLeft="60dp"
android:layout_marginTop="14dp"
android:layout_toRightOf="@+id/textView1"
android:text=""
android:textSize="30sp" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/textView1"
android:layout_below="@+id/lng"
android:layout_marginTop="53dp"
android:text="Latitude:" />
<TextView
android:id="@+id/lat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/lng"
android:layout_below="@+id/textView3"
android:text=""
android:textSize="30sp" />
</RelativeLayout>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.