カメラで撮影した画像を縮小して、アプリのマップビューに配置しようとしています。ただし、画像を撮ることはできますが、サムネイルサイズの画像に縮小するようには見えません。ここに MainActivity.java の私のコードがあります
AlertDialog alert = new AlertDialog.Builder(MainActivity.this).create();
alert.setTitle("Create Marker");
alert.setButton(DialogInterface.BUTTON_POSITIVE, "Take Photo", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//TODO Auto=generated method stub
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File photo = new File(Environment.getExternalStorageDirectory(), "Pic.jpg");
intent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photo));
o = Uri.fromFile(photo);
startActivityForResult(intent, TAKE_PICTURE);
BitmapDrawable bd = (BitmapDrawable) Drawable.createFromPath(new File(Environment.getExternalStorageDirectory(), "pic.jpg").getAbsolutePath());
Bitmap b = Bitmap.createScaledBitmap(bd.getBitmap(), (int) (bd.getIntrinsicHeight() * 0.8),
(int) (bd.getIntrinsicWidth() * 0.8), false);
OverlayItem overlayItem = new OverlayItem(touchedPoint, "What's Up", "2nd String");
CustomPinPoint custom = new CustomPinPoint(d, MainActivity.this);
custom.insertPinpoint(overlayItem);
overlayList.add(custom);
}
});
alert.show();
{
return true;
}
}
return false;
と私の CustomPinPoint.java
public class CustomPinPoint extends ItemizedOverlay<OverlayItem>{
BitmapDrawable bd;
Bitmap b;
private ArrayList<OverlayItem> pinpoints = new ArrayList<OverlayItem>();
private Context c;
public CustomPinPoint(Drawable defaultMarker) {
super(boundCenter(defaultMarker));
BitmapDrawable bd = (BitmapDrawable) Drawable.createFromPath(new File(Environment.getExternalStorageDirectory(), "pic.jpg").getAbsolutePath());
Bitmap b = Bitmap.createScaledBitmap(bd.getBitmap(), (int) (bd.getIntrinsicHeight() * 0.8),
(int) (bd.getIntrinsicWidth() * 0.8), false);
// TODO Auto-generated constructor stub
}
public CustomPinPoint(Drawable m, Context context) {
this(m);
c = context;
// TODO Auto-generated constructor stub
}
@Override
protected OverlayItem createItem(int i) {
// TODO Auto-generated method stub
return pinpoints.get(i);
}
@Override
public int size() {
// TODO Auto-generated method stub
return pinpoints.size();
}
public void insertPinpoint(OverlayItem item){
pinpoints.add(item);
this.populate();
}
public void add(CustomPinPoint custom) {
// TODO Auto-generated method stub
}
public void add(OverlayItem i) {
// TODO Auto-generated method stub
}
}
誰が私が間違っているのか教えてもらえますか?