'Android'에 해당되는 글 6건
- 2015.06.18 맥용 안드로이드 개발 셋팅
- 2013.05.28 안드로이드 파일 입출력과 관련된 경로 얻기
- 2013.01.23 [Android] convert intent to bitmap
- 2013.01.21 [Android] Convert bitmap to file
- 2013.01.21 [Android] convert drawable to bitmap
- 2010.10.19 맥에서 안드로이드 개발하기
송신
Intent i = new Intent(this, NextActivity.class);
Bitmap b; // your bitmap
ByteArrayOutputStream bs = new ByteArrayOutputStream();
b.compress(Bitmap.CompressFormat.PNG, 50, bs);
i.putExtra("byteArray", bs.toByteArray());
startActivity(i);
수신
if(getIntent().hasExtra("byteArray")) {
ImageView previewThumbnail = new ImageView(this);
Bitmap b = BitmapFactory.decodeByteArray(
getIntent().getByteArrayExtra("byteArray"),0,getIntent().getByteArrayExtra("byteArr
ay").length);
previewThumbnail.setImageBitmap(b);
}
Reference: http://blog.naver.com/zighart8456/159472785
//assume that variable b is Bitmap instance
String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
OutputStream outStream = null;
File file = new File(extStorageDirectory, "er.PNG");
try {
outStream = new FileOutputStream(file);
b.compress(Bitmap.CompressFormat.PNG, 100, outStream);
outStream.flush();
outStream.close();
}
catch(Exception e)
{}
Reference : http://stackoverflow.com/questions/649154/android-bitmap-save-to-location
FROM drawable TO bitmap :
Drawable d = ImagesArrayList.get(0);
Bitmap bitmap = ((BitmapDrawable)d).getBitmap();
FROM resource id of drawable TO bitmap:
Bitmap b1 = BitmapFactory.decodeResource(context.getResources(), R.drawable.icon_resource);
Reference:
http://stackoverflow.com/questions/3035692/how-to-convert-a-drawable-to-a-bitmap
아래의 링크를 따라가서 필요한 프로그램을 다운받고 설치하면 된다.
단, 이클립스 버젼은 갈릴레오로(아직 헬리오스는 불안정한 것 같다.), Mac OS X(Cocoa 64)를 선택한다. Snow Leopard(Mac OS X 10.6.x) 기준임.