티스토리 뷰


public Bitmap assetsRead(String file) {
		InputStream is;
		Bitmap bitmap = null;
		
		try {
			is = mContext.getAssets().open(file);
		
		  int size = is.available();
		  byte[] buffer = new byte[size];
		  is.read(buffer);
		  is.close();
		  
		  bitmap = BitmapFactory.decodeByteArray( buffer, 0, buffer.length ) ;  
		 
		  bitmap = Bitmap.createScaledBitmap(bitmap, 300, 340, true);
		  
		} catch (IOException e) {
			
			e.printStackTrace();
		}
		
		
		 return bitmap ;  
    }


매개변수는 파일 경로를 넣어주면 된다. 소스에 300, 340 은 비트맵 사이즈를 리사이징 하는 부분


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2026/02   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
글 보관함