0
如果我拍攝一張照片,它將顯示在圖像視圖中。但是,我怎樣才能將照片另存到硬盤上?拿他的相機設置的大小?保存圖片並加載到圖像視圖中
public class Note extends Activity {
TextView t;
ImageView iv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.note);
iv=(ImageView) findViewById(R.id.imageView);
Button btn = (Button) findViewById(R.id.photo);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 0);
}
});
}
public void button (View view){
Intent intent = new Intent(view.getContext(),Note2.class);
startActivityForResult(intent, 0);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode==0)
{
Bitmap theImage = (Bitmap) data.getExtras().get("data");
iv.setImageBitmap(theImage);
}}
}
我事先感謝您的幫助。