Android开发资料[20121223]

1. android 拍照上传照片

参考网址: http://blog.csdn.net/yaoyeyzq/article/details/7254679

第一种方式是用方法中传回来的intent调用getData();方法获取数据的Uri,然后再根据uri获取数据的路径,然后根据路径封装成一个bitmap就行了.

第二种方式也是用法中传回来的intent对象但是不再是调用getData();方法而是调用getExtras();方法获取intent里面所有参数的一个对象集合bundle,然后是用bundle对象得到键为data的值也就是一个bitmap对象.

            Uri uri = data.getData();
            if (uri != null) {
                photo = BitmapFactory.decodeFile(uri.getPath());
            }
            if (photo == null) {
                Bundle bundle = data.getExtras();
                if (bundle != null) {
                    photo = (Bitmap) bundle.get("data");
                } else {
                    Toast.makeText(DefectManagerActivity.this,
                            getString(R.string.common_msg_get_photo_failure),
                            Toast.LENGTH_LONG).show();
                    return;
                }
            }

2. 

原文地址:https://www.cnblogs.com/yinger/p/2825738.html