안드로이드
-
[Android] How to get image file from assets & set bitmap to canvas.Frontend/android 2021. 2. 5. 16:22
Bitmap assetsRead(String file) { InputStream is; Bitmap bitmap = Bitmap.createBitmap(previewWidth, previewHeight, Config.ARGB_8888); try { is = 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, 720, 720, false); } catch (IOE..