how can i store an icon into Blob?
anyone please help me on this topic
Drawable icon = p.applicationInfo.loadIcon(getPackageManager());
Blob b;
I have try this ::
button1 = (Button)findViewById(R.id.button1);
try{
ImageView iv = (ImageView) findViewById(R.id.splashImageView);
ImageView iv2 = (ImageView)findViewById(R.id.imageView1);
Drawable d =iv.getBackground();
BitmapDrawable bitDw = ((BitmapDrawable) d);
Bitmap bitmap = bitDw.getBitmap();
System.out.println(".....d....."+d);
System.out.println("...bitDw...."+bitDw);
System.out.println("....bitmap...."+bitmap);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] imageInByte = stream.toByteArray();
System.out.println("imageInByte"+imageInByte);
String s = imageInByte.toString();
byte[] imageInByte2 = s.getBytes();
Bitmap btmp = convertByteArrayToBitmap(imageInByte2);
/*iv.setImageResource(R.drawable.icon);*/
iv2.setImageBitmap(btmp);
}catch (Exception e) {
e.printStackTrace();
}
// i1.insertDataUser("tableName",3,"appname","pname", "versionName", 2,"s", 2121);
/* int a = i1.GetUserData(getApplicationContext(), "tablename",1);
System.out.println("a is "+a);
System.out.println(" i1.app_id"+i1.app_name);
System.out.println(" i1.app_id"+i1.pname);
System.out.println(" i1.app_id"+i1.version_name);
System.out.println(" i1.app_id"+i1.versionCode);
System.out.println(" i1.app_id"+i1.date);
System.out.println(" i1.app_id"+i1.icon);*/
}
public static Bitmap convertByteArrayToBitmap(
byte[] byteArrayToBeCOnvertedIntoBitMap) {
Bitmap bitMapImage = BitmapFactory.decodeByteArray(
byteArrayToBeCOnvertedIntoBitMap, 0,
byteArrayToBeCOnvertedIntoBitMap.length);
return bitMapImage;
}