Photographic Memory
size of the SurfaceView. When the camera button is clicked, we take a
picture, re-enabling the preview in the PhotoCallback.
Step #4: Tie In the Photographer Class............................................
Finally, we need to allow the user to take a picture. Since we (theoretically)
want our photos taken with Photographer to be associated with the
restaurant, we can add an option menu choice to our DetailForm. Here is the
revised LunchList/res/menu/option_detail.xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/call"
android:title="Call"
android:icon="@drawable/ic_menu_call"
/>
<item android:id="@+id/photo"
android:title="Take a Photo"
android:icon="@drawable/ic_menu_camera"
/>
</menu>
We also need to update onOptionsItemSelected() in DetailForm to watch for
this new menu choice, so modify yours to look like:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId()==R.id.call) {
String toDial="tel:"+phone.getText().toString();
if (toDial.length()> 4 ) {
startActivity(new Intent(Intent.ACTION_CALL,
Uri.parse(toDial)));
return(true);
}
}
else if (item.getItemId()==R.id.photo) {
startActivity(new Intent(this, Photographer.class));
return(true);
}
return(super.onOptionsItemSelected(item));
}