在我的应用程序,我想用相机捕捉图像并传送到服务器。
in my app i want use the camera for capturing image and send to a server.
当用户打开我的应用程序的摄像部分,我想告诉他,他正在使用的设备的默认摄像头。在present下面是两行code里面我是用捕获的图像
When the user opens the Camera part of my app, i want to show him the default camera of the device he is using. At present following is the two line code which i am using to capture image
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, TAKE_RECEIPT);
当我运行在HTC的手机本code,拍摄图像后,显示图像的preVIEW以完成和重拍按钮。当我点击完成将其移动到previous活动。
When i run this code in a HTC device, after capturing the image it showed a preview of the image with a done and retake button. When i click done it moves to the previous activity.
当我在摩托设备使用code,拍摄图像后,显示图像的preVIEW以插入,重新夺回并取消即可。当我点击完成将其移动到previous活动。
when i use the code in a moto device, after capturing the image it showed a preview of the image with a insert, retake and cancel. When i click done it moves to the previous activity.
喜欢这个会被不同的所有设备。因此,当我点击任何设备进行或插入或其他任何按键正面按键我要开始上传过程。
Like this it will be differing for all devices. So when i click the done or insert or any other button positive button of any devices i want to start the uploading process.
如何进行此请帮我....
How to proceed this please help me....
您可以使用下面code为您解决问题...
You can use below code to solve your problem...
protected void startCameraActivity()
{
// TODO Auto-generated method stub
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
startActivityForResult( intent, 0 );
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
switch( resultCode )
{
case 0:
break;
case -1:
onPhotoTaken();
break;
}
}
protected void onPhotoTaken()
{
///write code here what you want to done after capture the image using device camera
}
@Override
protected void onRestoreInstanceState( Bundle savedInstanceState)
{
if( savedInstanceState.getBoolean( add_project1.PHOTO_TAKEN ) )
{
onPhotoTaken();
}
}
@Override
protected void onSaveInstanceState( Bundle outState )
{
outState.putBoolean( add_project1.PHOTO_TAKEN, _taken );
}
上一篇:android.content.ActivityNotFoundException当链接不包含HTTP不包含、链接、content、android
下一篇:在 vue 3 中使用 vue-chartjs:createElement 不是函数函数、不是、vue、chartjs