我正在尝试拍照并将其保存在Gallary应用中。到目前为止,我设法编写了以下代码:
public void sendMessages(View view) {
Intent intent = new Intent(this, MessagingAdapter.class);
startActivity(intent);
}
public void takePicture(View view) {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, getImageUri());
startActivityForResult(cameraIntent, TAKE_PHOTO_CODE);
}
public Uri getImageUri() {
picNo++;
String storageFolderPath = Environment.getExternalStorageDirectory() + "/CameraImages/";
String fullFileName = storageFolderPath + picNo + ".jpg";
File newPic = new File(fullFileName);
Uri outputFileUri = Uri.fromFile(newPic);
return outputFileUri;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == 1)
return;
if (requestCode == 3) {
Uri uri = data.getData(); //YOU GET DATA HERE
}
}
它正常工作且没有错误。但是,它不能按我的意愿运作。
我正在测试Nexus-7(CynongeMode)。我的应用程序可以打开相机。但是在拍摄之后,它会在拍摄的图像上冻结并提供3个选项(相机应用程序是内置应用程序):
答案 0 :(得分:1)
您是否已将权限放入private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if(comboBox1.Text=="Suma")
{
decimal s = 0;
decimal temp;
for (int i = 0; i < numericUpDown1.Value; i++)
{
var currentNumUpDown = this.panel1.Controls["numericUpDown" + (100 + i).ToString()] as NumericUpDown;
var currentNumUpDown2 = this.panel1.Controls["numericUpDown" + (200 + i).ToString()] as NumericUpDown;
temp = currentNumUpDown.Value * currentNumUpDown2.Value;
s = s + temp;
}
richTextBox1.Text = s.ToString();
Fin = s;
}
if (comboBox1.Text == "Produs")
{
decimal p = 1;
decimal temp;
for (int i = 0; i < numericUpDown1.Value; i++)
{
var currentNumUpDown = this.panel1.Controls["numericUpDown" + (100 + i).ToString()] as NumericUpDown;
var currentNumUpDown2 = this.panel1.Controls["numericUpDown" + (200 + i).ToString()] as NumericUpDown;
temp = currentNumUpDown.Value * currentNumUpDown2.Value;
p = p * temp;
}
richTextBox1.Text = p.ToString();
Fin = p;
}
if (comboBox1.Text == "Minim")
{
decimal minim = 2;
decimal temp;
for (int i = 0; i < numericUpDown1.Value; i++)
{
var currentNumUpDown = this.panel1.Controls["numericUpDown" + (100 + i).ToString()] as NumericUpDown;
var currentNumUpDown2 = this.panel1.Controls["numericUpDown" + (200 + i).ToString()] as NumericUpDown;
temp = currentNumUpDown.Value * currentNumUpDown2.Value;
if (minim > temp)
minim = temp;
}
richTextBox1.Text = minim.ToString();
Fin = minim;
}
if (comboBox1.Text == "Maxim")
{
decimal maxim = -2;
decimal temp;
for (int i = 0; i < numericUpDown1.Value; i++)
{
var currentNumUpDown = this.panel1.Controls["numericUpDown" + (100 + i).ToString()] as NumericUpDown;
var currentNumUpDown2 = this.panel1.Controls["numericUpDown" + (200 + i).ToString()] as NumericUpDown;
temp = currentNumUpDown.Value * currentNumUpDown2.Value;
if (maxim < temp)
maxim = temp;
}
richTextBox1.Text = maxim.ToString();
Fin = maxim;
}
}
?
Manifest.xml