Android 将相机的照片保存到内存中
我是这个网站和安卓的新手。如何将相机的图片保存到特定文件夹中并将图片的名称也保存到sqlite数据库中。
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.camera);
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
File photo = new File(Environment.getExternalStorageDirectory(), "Pic.jpg");
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photo));
imageUri = Uri.fromFile(photo);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
onActivityResult(1337, 0, cameraIntent);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == CAMERA_PIC_REQUEST) {
}
我打开了相机活动。如何获取图片名称和图片名称将其保存到特定位置?
请帮我解决这个问题。
先感谢您。
I am new to this site and android. how to save the camera's picture into specific folder and save the picture's name into sqlite databse also.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.camera);
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
File photo = new File(Environment.getExternalStorageDirectory(), "Pic.jpg");
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photo));
imageUri = Uri.fromFile(photo);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
onActivityResult(1337, 0, cameraIntent);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == CAMERA_PIC_REQUEST) {
}
I opened camera activity. How to get the picture name & save it to particular location?
please help me on this.
thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我正在调用相机
并像这样保存到 SD 卡
I'm calling camera
and saving to sd card like this
您可能需要将该行更改
为
You may need to change the line
to
您已经在保存图片了。您在 MediaStore.EXTRA_OUTPUT 中提供了位置。
链接
做数据库你必须看看这个<一href="http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBcQFjAA&url=http://developer.android.com/refere nce/android/database/sqlite/package-summary.html&ei=Y5E6TuHGMNK4hAecrO2jBQ&usg=AFQjCNF8aHy__4EKyivNW9vK1dQKVVb5ag" rel="nofollow">link 解释起来有点太多
You are already saving the picture. You provided the location in MediaStore.EXTRA_OUTPUT.
Link
Doing a DB you will have to have a look at this link is a little bit to much to explain