Android摄像机:数据意图返回空
public void onClick(View view) { Intent photoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(photoIntent, IMAGE_CAPTURE);}
OnActivityResult
@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == IMAGE_CAPTURE) { if (resultCode == RESULT_OK) { Bitmap image = (Bitmap) data.getExtras().get("data"); ImageView imageview = (ImageView) findViewById(R.id.pic); imageview.setImageBitmap(image); } else if (resultCode == RESULT_CANCELED) { Toast.makeText(this, "CANCELED ", Toast.LENGTH_LONG).show(); } }}
data
OnActivityResult
(resultCode == RESULT_CANCELED)
ImageView
陪伴而非守候
相关分类