Sensing a Disturbance
i.putExtra(ID_EXTRA,
String.valueOf(adapter.getItemId(selection)));
startActivity(i);
}
};
If you rebuild and reinstall the application on a device, you can randomly
choose a restaurant by giving the phone a solid shake.
Extra Credit
Here are some things you can try beyond those step-by-step instructions:
- Store the GPS coordinates of the restaurant via the DetailForm.
Then, given your current position and the location of the
restaurant, present a compass to help point you in the right
direction, in case you forget where the restaurant is. WARNING:
this may involve icky math.
- Attempt to use the accelerometer to measure your current speed
while walking or jogging. Remind yourself partway through why,
exactly, you elected not to be a physics major in college. If you were
a physics major in college, the author offers his sincere condolences.
Further Reading
More information about accessing and leveraging the orientation and
acceleration sensors in Android is found in the "Sensors" chapter of The
Busy Coder's Guide to Advanced Android Development.