2014-12-24 5 views
0

카메라 의도에서 캡처 한 이미지를 표시하려고하는데 showPhoto 메서드를 호출하면 이미지가 ImageView에 표시되지 않습니다. 스택 추적에 오류 출력이 없으므로 문제를 어떻게 디버깅 할 수 있는지 잘 모르겠습니다.ImageView에서 캡처 한 이미지를 표시하는 방법은 무엇입니까?

캡쳐 된 이미지가 표시되지 않는 방법에 어떤 문제가 있는지 알고 있습니까? 이것은 내가 따라 한 튜토리얼

private void showPhoto(Uri photoUri) { 
      String filePath = photoUri.getEncodedPath(); 
      File imageFile = new File(filePath); 
      //File imageFile = new File(photoUri.getPath()); 
      if (imageFile.exists()){ 
      Drawable oldDrawable = photoImage.getDrawable(); 
      if (oldDrawable != null) { 
       ((BitmapDrawable)oldDrawable).getBitmap().recycle(); 
      } 
      Bitmap bitmap = BitmapFactory.decodeFile(imageFile.getAbsolutePath()); 
      BitmapDrawable drawable = new BitmapDrawable(this.getResources(), bitmap); 
      photoImage.setScaleType(ImageView.ScaleType.FIT_CENTER); 
      photoImage.setImageDrawable(drawable); 
      }  
     } 

: 다음과 같이

showPhoto 방법은 http://www.linux.com/learn/tutorials/722038-android-calling-the-camera

I가 테스트하고있어이 장치는 JellyBean 4.1있다가 이것이 전체에 대한 링크입니다 클래스 :

http://hastebin.com/oqokupulol.java

+0

의 ImageView.setImageBitmap (비트 맵)를 사용하여로드합니다. 비트 맵의 ​​품질을 낮춰보십시오. –

답변

1

사용 BitmapOptions.inJustDecodeBounds는 차원을 찾을 수

일반적으로 먼저 이미지, 안드로이드보다 이미지가 더 큰로드되지 않습니다 4000px/전체 높이

너무 큰 이미지를 다운 스케일을 BitmapOptions.inSampleSize를 사용할 수있는 이미지를 발견하면 안드로이드는 것이다 그래야 이

그리고 사실

, 직접이 때문에 사진의 품질이 될 수 있습니다 대신 setImageDrawable

관련 문제