이 솔루션은 :
그래서, 결국 내 문제에 대한 해결책을 발견했다. 대신에 나는 getAllContact()
전화를 할 때 Bitmaps
을 모두 얻는, 비트 맵의는 사용자가 내 ListView
String PCN = cases.get(position).getCaseNumber();
int tempPCN = Integer.valueOf(PCN);
tempBitMapArray = dbHandler.getFinger(tempPCN);
Bitmap left = tempBitMapArray[0];
Bitmap right = tempBitMapArray[1];
ByteArrayOutputStream bs1 = new ByteArrayOutputStream();
left.compress(Bitmap.CompressFormat.PNG, 100, bs1);
ByteArrayOutputStream bs2 = new ByteArrayOutputStream();
right.compress(Bitmap.CompressFormat.PNG, 100, bs2);
그리고 getFinger(...)
에 대한 CustomAdapter의 setOnClickListener
방법에서 수행 무슨 일이있는 ListView
의 행을 누를 때로드 방법 :
public Bitmap[] getFinger(int pcn) {
Bitmap[] fingers = new Bitmap[2];
String SQLQUERY = "SELECT " + RIGHTFINGER + ", " + LEFTFINGER +" FROM " + TABLE_CASES + " WHERE " + KEY_ID + "=" + pcn + ";";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(SQLQUERY, null);
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 2;
if (cursor.moveToFirst()) {
do {
byte[] blob1 = cursor.getBlob(cursor.getColumnIndexOrThrow("leftFinger"));
Bitmap bmp1 = BitmapFactory.decodeByteArray(blob1, 0, blob1.length, options);
byte[] blob2 = cursor.getBlob(cursor.getColumnIndexOrThrow("rightFinger"));
Bitmap bmp2 = BitmapFactory.decodeByteArray(blob2, 0, blob2.length, options);
fingers[0] = bmp1;
fingers[1] = bmp2;
return fingers;
} while(cursor.moveToNext());
}
return null;
}
이 예제가 다른 사람들에게 올바른 방향으로 정확하게 전달되기를 바랍니다.
일부 알고리즘에 대해서는 Server-Side에서 전체 크기의 비트 맵이 필요하기 때문입니다. –
풀 사이즈 버전과 작은 버전의 비트 맵을 만드는 것은 어떨까요? – ikh
@ikh 의견을 보내 주셔서 감사합니다. 하지만 지금은 사용자가 목록보기의 항목을 누르면 이미지를로드하려고합니다. –