![]() |
![]() |
MapDemoActivity
class that uses a
TextView
object to prompt for the location and then
stores the latitude and longitude in two EditText
objects.
Button
object with the label "Show
Location" to run the showLocation()
method that uses the
lat/long values provided by the user to start an activity that
displays a map of the location.
Button
that shows the location must be connected
to the MapDemoActivity.showLocation()
method via the
android:onClick="showLocation"
attribute.
geo:
URI intent solution, which should work if you're
running on an Android phone (I recommend using the approach described
here
to see if this works). If the geo:
URI intent doesn't
work properly then use the http://maps.google.com
URI
intent instead.
TextView
,
EditText
, or Button
objects into your
MapDemoActivity
class.
All the lifecycle events associated with your
MapDemoActivity
class must be logged to LogCat via the
Log.d()
method, e.g.:
08-26 20:27:48.580: D/MapDemo(3323): onCreate()
08-26 20:27:48.610: D/MapDemo(3323): onStart()
08-26 20:27:48.610: D/MapDemo(3323): onResume()
...
Your MapDemoActivity
class should inherit from a parent
class called LifecycleLoggingActivity that defines the associated hook
methods to perform this logging, as follows:
public class LifecycleLoggingActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
/* you fill in here. */
}
public void onRestart() {
/* you fill in here. */
}
public void onStart() {
/* you fill in here. */
}
public void onResume() {
/* you fill in here. */
}
public void onPause() {
/* you fill in here. */
}
public void onStop() {
/* you fill in here. */
}
public void onDestroy() {
/* you fill in here. */
}
}
If you find it extremely hard to complete this assignment you may not be ready to take this class. If this is the case, I recommend you take the Intermediate Software Design course (CS 251) first since it focuses on the patterns and tactics of effective OO design and programming.
Back to CS 282 home page.