I have an android application that is used by customer from supermarkets. This application should provide photos of goods.
Photos are uploaded from asp.net web application to a Microsoft sql server 2008 image field. Then, mobile application receives this byte array to the mobile phone as a xml string. After that, this array is saved in a sqlite db blob field.
Now my problem is I cannot see these images even though i received a byte array.
Following would show my code.
Java Android Saving image
String iid = id.item(j).getFirstChild().getTextContent();
String iname = name.item(j).getFirstChild().getTextContent();
String ibrand = brand.item(j).getFirstChild().getTextContent();
String icategory = category.item(j).getFirstChild().getTextContent();
String iuom = uom.item(j).getFirstChild().getTextContent();
String iprice = price.item(j).getFirstChild().getTextContent();
String iimage = image.item(j).getFirstChild().getTextContent();
Items t = new Items(iid, iname, ibrand, icategory, iuom, Double.parseDouble(iprice), iimage.getBytes(), true);
I retreive that image to byte array using cursor and following I.GetImage() returns a byte array. Following table is also working fine except bitmap part
ImageView img=new ImageView(this);
Bitmap bm = BitmapFactory.decodeByteArray(I.GetImage(), 0, I.GetImage().length);
//DisplayMetrics dm = new DisplayMetrics();
//getWindowManager().getDefaultDisplay().getMetrics(dm);
//img.setMinimumHeight(dm.heightPixels);
//img.setMinimumWidth(dm.widthPixels);
img.setMinimumHeight(100);
img.setMinimumWidth(50);
img.setPadding(20, 20, 20, 20);
img.setImageBitmap(bm);
tableRow.addView(img);
- Could anyone tell me what to do and how to fix this issue? Thanks in advance