how to add the images to gallery in android from sdcard
<p>My aim is to bulit a camera application to click a picture and paste it to some predefined frame or some other frame collected from sd card.</p>

<p>I have already seen these questions:</p>

<p><a href="http://stackoverflow.com/questions/2507898/how-to-pick-a-image-from-gallery-sd-card-for-my-app-in-android">how to pick a image from gallery (SD Card) for my app in android?</a></p>

<p><a href="http://stackoverflow.com/questions/2169649/open-an-image-in-androids-built-in-gallery-app-programmatically/4470069#4470069">Open an image in Android&#39;s built-in Gallery app programmatically</a></p>

<p>My code is</p>

<pre><code>private Gallery gallery;
private ImageView imgView;
public Integer[] Imgid = {
        R.drawable.newframe, R.drawable.newframe1, R.drawable.newframe2, R.drawable.newframe3, R.drawable.newframe4,
        R.drawable.newframe5,R.drawable.newframe6};
public class AddImgAdp extends android.widget.BaseAdapter {
    int GalItemBg;
    private Context cont;

    public AddImgAdp(Context c){
        cont = c;
        TypedArray typArray = obtainStyledAttributes(R.styleable.GalleryTheme);
        GalItemBg = typArray.getResourceId(R.styleable.GalleryTheme_android_galleryItemBackground, 0);
        typArray.recycle();
    }
    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return Imgid.length;
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        ImageView imgView = new ImageView(cont);

        imgView.setImageResource(Imgid[position]);
        imgView.setLayoutParams(new Gallery.LayoutParams(90, 70));
        imgView.setScaleType(ImageView.ScaleType.FIT_XY);
        imgView.setBackgroundResource(GalItemBg);
        return imgView;
    }

}
</code></pre>

<p>I used this to select predefined frames.</p>

<pre><code>public void selectFrame() {
    imgView = (ImageView)findViewById(R.id.widgetImageView);    
    //imgView.setImageResource(Imgid[0]);

    gallery = (Gallery) findViewById(R.id.widgetGallery);
    gallery.setAdapter(new AddImgAdp(this));
    gallery.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView parent, View v, int position, long id) {
            Bitmap bmp = BitmapFactory.decodeResource(getResources(), Imgid[position]); 
            detectFrame(bmp);

        }
    });
}
</code></pre>

<p>This is what I used to select frame images(.png images) from sdcard</p>

<pre><code>if(resultCode==RESULT_OK){
            Uri selectedImage = data.getData();
            String[] filePathColumn = {MediaStore.Images.Media.DATA};

            Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
            cursor.moveToFirst();

            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            String filePath = cursor.getString(columnIndex);
            cursor.close();
            Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath);

            Toast toast= Toast.makeText(this, selectedImagePath, Toast.LENGTH_SHORT);
            toast.setGravity(Gravity.TOP, 0, 0);
            toast.show();
        } 
</code></pre>

<p>Now the problem is what I am getting is the file path but have no idea how to add them,I mean those frame images to that gallery.</p>
