blob 이미지 insert, update , select 방법 - 이미지를 blob로 변환해서 db에 저장하면 보안상 도움이 됩니다. - 단 db용량이 커지기 때문에 이미지는 blob보다는 sd카드나 웹에서 다운받아서 파일로 사용하는것이 좋습니다. - blob select시 db row가 증가하게 되면 table 쿼리 속도가 느려지는 문제가 있는데 table에 index를 적용해서 table 을 만들면 속도가 빨라집니다 - 예제 (db를 만들고 , table 명 MASTER_IMAGE , 칼럼 IMAGE(blob) 로 테이블을 만들어줍니다) -> sd카드의 이미지를 읽어와서 byte[]로 만든 후 blob 칼럼에 업데이트 해주고 있습니다 ImageView blobImg; @Override public ..
Android - track down memory leaks My current Android application project is starting to make sense. Unfortunately it crasches after a few levels of playing due to java.lang.OutOfMemoryError. Up to that point I hadn't put much thinking into the memory model of Android applications and simply consumed memory without hesitations. I've now been forced to rewrite some critical parts of the applicatio..
private Bitmap combineImage(Bitmap first, Bitmap second, boolean isVerticalMode){ Options option = new Options(); option.inDither = true; option.inPurgeable = true; Bitmap bitmap = null; if(isVerticalMode) bitmap = Bitmap.createScaledBitmap(first, first.getWidth(), first.getHeight()+second.getHeight(), true); else bitmap = Bitmap.createScaledBitmap(first, first.getWidth()+second.getWidth(), firs..
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 bit..
원 출처는 http://jeehun.egloos.com/4077813 입니다. 출처에 소스에 문제점은 리스트에서 이미지를 선택할때마다 이미지를 리로딩하는 과정이 있어서 속도면에서 떨어지는 단점이 있어서 이를 수정하였습니다. 처음 1회에 이미지를 로딩하고, 그뒤부터는 로딩과정을 없앴습니다. 속도가 훨씬 빨라졌네요. 출처에는 이미지를 보여주는기능까지만 되어있는데 최적화에 추가로 이미지 선택시 체크까지는 만들어두었습니다.질문과 지적은 감사합니다. 소스 공유합니다.