Q:

View image in android built-in viewer

I need to view the image in android default image viewer when i execute the following code it's shows the album list instead Of particular image. please correct me.
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);
    }
});

A:

I have found the answer for my question see the answer below
@Override
        public void onScanCompleted(String path, Uri uri)
        {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(uri, "image/*");
            startActivity(intent);
        }

after analyse the android Intent source code my learning is, if you set uri in Intent constructor then set type, the data uri automatically set to null, so i can't access the particular image in image viewer.
Refer the source

