How to add saved images to mediastore and generate thumbnails?
<p>I am writing an Android app which can take pictures and save them on the SD card. Later, I need to display the pictures in a GridView and the user can select one. This is my code to save pictures:</p>

<pre><code>Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
        @Override
        public void onPictureTaken(byte[] data, Camera c) {         
            currentPictureName = (String) getResources().getText(R.string.username) 
                    + System.currentTimeMillis() + ".jpg";

            FileOutputStream outStream = null;
            try {
                outStream = new FileOutputStream(sdcardPath + currentPictureName);
                outStream.write(data);
                outStream.close();
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                mCamera.startPreview();
            }
        }
</code></pre>

<p>However, none of the saved images have thumbnails to show in the GridView. How do I automatically generate thumbnails for all images that I save and add everything to <code>MediaStore</code> so that they can be accessed later?</p>
