我在尝试调试Android应用程序时遇到问题。
这是我的代码。 Android应用程序必须显示从相机拍摄的图像。
private class buttonTakePicture implements Button.OnClickListener {
public void onClick(View v) {
takePhoto(v);
}
}
private class buttonGalleryAccess implements Button.OnClickListener {
public void onClick (View arg0) {
Intent accesGallery = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(accesGallery, SELECT_PICTURE);
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK && requestCode == 1) {
try {
Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory()+"/Proyecto/"+"foto.jpg");
imageView1.setImageBitmap(bitmap);
//imageView1.setImageBitmap(detectarObjecto(bitmap));
// bitmap.recycle();
}catch(Exception e){
Log.v("ERROR BITMAP",e.toString());
}
}
}
private void takePhoto(View v) {
//Creating the intent to call the camera
Intent intent = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
//Creating a folder to store our images
File carpetaImagenes = new File(Environment.getExternalStorageDirectory(), "Proyecto");carpetaImagenes.mkdirs();
//We name our image
File nombreImagen = new File(carpetaImagenes, "foto.jpg");
uriImagenGuardada = Uri.fromFile(nombreImagen);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uriImagenGuardada);
startActivityForResult(intent, 1);
}
因此,有趣的部分是从卡马拉拍摄图像,我应该能够使用imageView在屏幕上显示它。我认为代码运行正常,但由于我收到此错误,我不确定:
以下错误。
11-02 22:00:21.553: E/Hwmsen_sensors(720): hwmsen: rotationvector -34177 11-02 22:00:21.749: E/Hwmsen_sensors(720): hwmsen: rotationvector -33323 11-02 22:00:21.949: E/Hwmsen_sensors(720): hwmsen: rotationvector -32778 11-02 22:00:22.149: E/Hwmsen_sensors(720): hwmsen: rotationvector -32985 11-02 22:00:22.351: E/Hwmsen_sensors(720): hwmsen: rotationvector -32589 11-02 22:00:22.549: E/Hwmsen_sensors(720): hwmsen: rotationvector -32711 11-02 22:00:22.754: E/Hwmsen_sensors(720): hwmsen: rotationvector -32748 11-02 22:00:22.915: E/Sensors(720): new acc setDelay handle(0),ns(20000000) err! go to hwmsen 11-02 22:00:23.111: E/Hwmsen_sensors(720): hwmsen: rotationvector -33314