ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • android 에서 지원하네요 bitmap을 출력할수있게
    과거...../개발일지 2010. 8. 16. 16:38



     FileOutputStream fileOutputStrema;
      try {
       fileOutputStrema = new FileOutputStream(abc);
       image.compress(Bitmap.CompressFormat.PNG , 100, fileOutputStrema);
       Log.i("dfdfdfdfdfdf","dfdfdfdfd");
      } catch (FileNotFoundException e) {
       e.printStackTrace();
      }

    compress 에 출력 파일 형식, 퀄리티, outputStream으로 지원합니다.
    자세한것이 필요하신분은 디벨로퍼사이트에서 검색하세요 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ


    원본 샘플 소스
     public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
           
            imageView01 = new ImageView(this);
           
            Bitmap image = BitmapFactory.decodeResource(this.getResources(), R.drawable.icon);
            mkdirFolder();
            imageSave(image,"bb.png");
           
        }
       
       
        private void mkdirFolder(){
         Boolean result;
         File file = new File("/sdcard/scrape/");
         if(!file.isDirectory()){
          result = file.mkdir();
         }
        }
       
       
        private void imageSave(Bitmap bitmap,String saveFileName){
         File abc = new File("/sdcard/scrape/", saveFileName);
            FileOutputStream fileOutputStrema = null;
      try {
       fileOutputStrema = new FileOutputStream(abc);
       bitmap.compress(Bitmap.CompressFormat.PNG , 100, fileOutputStrema);
       fileOutputStrema.flush();
      } catch (FileNotFoundException e) {
       e.printStackTrace();
      } catch (IOException e) {
       e.printStackTrace();
      }
         
        }

Designed by Tistory.