我需要在android默认图像查看器中查看图像,当我执行下面的代码时,它显示的是专辑列表而不是特定图像。请纠正我。在android内置查看器中查看图像
MediaScannerConnection.scanFile(this, new String[] {receiptPath}, new String[] {"image/*"}, new MediaScannerConnection.OnScanCompletedListener()
{
@Override
public void onScanCompleted(String path, Uri uri)
{
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.setType("image/*");
startActivity(intent);
}
});
是recepitPath文件夹或文件? – alex 2013-02-19 09:31:39
它是文件ex。 /mnt/sdcard/com.example.folder/receipt.png – 2013-02-19 09:36:15
如果它是一个文件,这可能是有帮助的 http://stackoverflow.com/questions/2954594/launching-intent-action-view-intent-not保存图片文件/ 3677598#3677598 – MikeIsrael 2013-02-19 09:41:02