你这段代码,经调用拍照功能,并将文件存在SD卡根目录下了,名称为tempImage.jpg。因为你这是调用相机功能拍照,并不是用手机自带的相机应用拍照,所以不会立马显示在相册中。DDMS里看不到SD卡吧我记得,你可以用adb shell自己看一下。

解决方案 »

  1.   

      public void sendScanBroadcast(String path) {
            Intent intent =
                    new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
            Uri uri = Uri.fromFile(new File(path));
            intent.setData(uri);
            Log.d(TAG, "sendScanBroadcast  path " + path + " uri " + uri);
            sendBroadcast(intent);
        }
    发个扫描广播就可以了,
      

  2.   

    intent.putExtra(MediaStore.EXTRA_OUTPUT, uriFile);
    这句话时保存路径 URIFILE是你自己写的uri 是file://格式的 不会显示在图库中
    先写contentprovider 然后在openfile(可能是在这里)写保存file方法 然后把uri传到上面的urifile 就会在图库显示了 
      

  3.   


         /**
         * 对文件夹进行扫描,使图库可以及时显示自己保存的图片(无需手机重启)
         */
        private void scanPhoto(String path) {//这里的path就是你保存图片的路径
            MediaScannerConnection
                    .scanFile(this, new String[] { path }, null, null);
        }
     
      

  4.   

    存完图片后再发送一个 Intent.ACTION_MEDIA_MOUNTED 广播告诉系统去重新mount 指定的文件夹;Intent intent = new Intent(Intent.ACTION_MEDIA_MOUNTED,Uri.parse("file://" + path));
    intent.putExtra("read-only", false);
    sendBroadcast(intent);这样图库中就有显示了。