【问题标题】:android capture photo and save it in image view and send it MMS?android捕获照片并将其保存在图像视图中并发送彩信?
【发布时间】:2015-04-09 12:36:24
【问题描述】:

如果我不想要这张照片并拍摄另一张照片并通过彩信发送照片,我想拍照并在图像视图中使用删除按钮显示它。

【问题讨论】:

标签: android eclipse imageview android-camera


【解决方案1】:

声明 Button 和 ImageView

ImageView imageView= (ImageView)this.findViewById(R.id.imageView1);
Button photoButton = (Button) this.findViewById(R.id.button1);

按钮 OnCLick 捕捉图像

 photoButton.setOnClickListener(new View.OnClickListener() {
       public void onClick(View v) {
                Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
                startActivityForResult(cameraIntent, CAMERA_REQUEST); 
            }
        });

将捕获的图像放入 ImageView

protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
        if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {  
            Bitmap photo = (Bitmap) data.getExtras().get("data"); 
            imageView.setImageBitmap(photo);
        }  
    }

需要在清单文件中添加

<uses-feature android:name="android.hardware.camera"></uses-feature> 

我不太清楚发送该图像彩信

更多参考

How to send image via MMS in Android?

【讨论】:

  • 我要CAMERA_REQUEST = 1888的意思;
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-09
  • 2017-06-14
相关资源
最近更新 更多