【发布时间】:2012-12-02 01:48:03
【问题描述】:
我对下面的代码有点怀疑
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent i=new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i, 0);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==0 && resultCode==RESULT_OK ){
Bundle extras = data.getExtras();
//get the cropped bitmap
Bitmap thePic = extras.getParcelable("data");
ImageView image =(ImageView) findViewById(R.id.imageView1);
image.setImageBitmap(thePic);
}
}
在 extras.getParcelable("data");此处的代码行“数据”作为 key 传递给 parcelable 对象。
我的问题是,是否已经在类中定义了名称为“数据”的键?或如何接受的任何原因。
【问题讨论】:
标签: android android-intent android-activity camera android-camera