我使用的意图来初始化以下操作 在对话框
现在此外,我想相机选项也该画廊选项画廊一起初始化相机的选择,我想下面的代码,但没有奏效
Intent cameraIntent = new Intent();
cameraIntent.setType(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.setType("image/*");
cameraIntent.setAction(Intent.ACTION_GET_CONTENT);
//startActivityForResult(Intent.createChooser(intent, "Select Picture"),0);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
它显示了库选项,但相机.. 帮我找出这个问题....
编辑:
public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch (item.getItemId()) {
case R.id.cameraa:
// Toast.makeText(this, "Save Project!", Toast.LENGTH_LONG).show();
Intent intents = new Intent("android.media.action.IMAGE_CAPTURE");
File photo = new File(Environment.getExternalStorageDirectory(),
"Pic.jpg");
intents.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
startActivityForResult(intents, 1);
break;
case R.id.gallery:
// Toast.makeText(this, "Take Snapshot!", Toast.LENGTH_LONG).show();
// ////This is gallery intent
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(
Intent.createChooser(intent, "Select Picture"), 0);
break;
}
return true;
}
您的建议@Hidde,谢谢,我接受ANS时,他们对我非常有用.. – Numair