假设我通过使用和意图(MediaStore.ACTION_IMAGE_CAPTURE)编写了一个相机应用程序,并且我注意到当我运行该应用程序时,选项菜单显示“编辑快捷方式”,我如何添加到此选项菜单或完全覆盖选项菜单以我自己的?
以下是我的代码片段:
public class GPSCam extends Activity implements LocationListener,
GpsStatus.Listener {
private Intent camIntent;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gpscam);
...
...
this.startCamera();
}
protected void startCamera() {
...
// create camera intent
camIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// define where to keep the photo
camIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
// this method will call onActivityResult() upon finishing an activity
// i.e. image captured
startActivityForResult(camIntent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
...
...
...
} }