My question here is that I am creating a small quiz to get the image above and its answer right below it. All this is done in a new action, where I want to show the answers to the quiz. There are about 40 questions, each with an image. Therefore, I tried using HashMap as follows: -
ListView lv = (ListView)findViewById(R.id.list1);
String[] from = new String[] {"ques","ans"};
int[] to = new int[] {R.id.ques, R.id.ans};
List<HashMap<String,Bitmap>> fillMaps = new ArrayList<HashMap<String,Bitmap>>();
Cursor c1 = db.getQues(4);
byte[] bb = c1.getBlob(0);
Bitmap image = BitmapFactory.decodeByteArray(bb, 0, bb.length);
HashMap<String,Bitmap> map = new HashMap<String, Bitmap>();
map.put("ques",image);
fillMaps.add(map);
SimpleAdapter adapter = new SimpleAdapter(this, fillMaps, R.layout.itemsign, from, to);
lv.setAdapter(adapter);
But I could not find a way to implement it correctly. This code does not work. It just shows a blank page. So any help would be greatly appreciated. Since I'm new to android, please be more detailed when explaining.
source
share