我想请求您关于Android内置摄像头界面的帮助
当我点击捕获时,屏幕捕获(意味着它冻结) 但是,当我点击确定时,它会挂起。它假设回到主界面,但它没有。 当我按下取消时,它会强行关闭。 代码很长,但这是我的倾听者:
@Override
protected void onActivityResult(int requestCode, int
resultCode, Intent data)
{
super.onActivityResult(requestCode,
resultCode, data);
Double x = null;
Toast.makeText(mContext, x.toString(),Toast.LENGTH_LONG);
if (resultCode == Activity.RESULT_OK) {
switch (requestCode) {
case CAMERA_PIC_REQUEST:
image.setImageURI(uri);
break;
}
}
}
感谢..
答案 0 :(得分:0)
这是调用相机界面的意图。
Intent intentCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intentCamera, CALL_CAMERA);
`protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent){
if(requestCode == CALL_CAMERA && resultCode == RESULT_OK)
{
if(imageReturnedIntent.getAction() != null)
{
// display image received on the view
Bundle newBundle = imageReturnedIntent.getExtras();
newBitmap = (Bitmap) newBundle.get("data");
if(newBitmap != null)
{
ImageView imageViewProfilePicture = (ImageView) this.findViewById(R.id.imageViewProfilePicture);
imageViewProfilePicture.setImageBitmap(newBitmap);
imageViewProfilePicture.invalidate();
}
}
}}`
答案 1 :(得分:0)
解决! startActivityForResult()子需要在类中。我把我放在我的onCreate子里面的onclick里面。 谢谢你们:D