How to show the captured image on the activity and simultaneously save it in the phone and inside the sqlite database?
===

I have taken a reference of capturing the image and saving it into SD Card. That is working fine. Now i want the image will show onto the activity until i click the button.
        Can anybody suggest me that how to make it possible????
        
        Here I am pasting the code. Kindly tell me where I am doing wrong here..
        
        The DVCamera.class
        
        public class DVCameraActivity extends Activity {  
        
        	static Uri capturedImageUri=null;
        	Button ButtonClick1,ButtonClick2;
        	ImageView image1,image2;
        	int CAMERA_PIC_REQUEST = 2; 
        	/** Called when the activity is first created. */
        	@Override
        	public void onCreate(Bundle savedInstanceState) {
        		super.onCreate(savedInstanceState);
        		setContentView(R.layout.main);
        
        		ButtonClick1 =(Button) findViewById(R.id.buttonClick1);
        		ButtonClick2 = (Button) findViewById(R.id.buttonClick2);
        		image2 =(ImageView) findViewById(R.id.PhotoCaptured2);
        		image1 =(ImageView) findViewById(R.id.PhotoCaptured1);
        		ButtonClick1.setOnClickListener(new OnClickListener (){
        			@Override
        			public void onClick(View view)
        			{
        				Calendar cal = Calendar.getInstance();
        				File file = new File(Environment.getExternalStorageDirectory(),  (cal.getTimeInMillis()+".jpg"));
        				if(!file.exists()){
        					try {
        						file.createNewFile();
        					} catch (IOException e) {
        						// TODO Auto-generated catch block
        						e.printStackTrace();
        					}
        				}else{
        					file.delete();
        					try {
        						file.createNewFile();
        					} catch (IOException e) {
        						// TODO Auto-generated catch block
        						e.printStackTrace();
        					}
        				}
        				capturedImageUri = Uri.fromFile(file);
        				Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        				// request code
        				//cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, capturedImageUri);
        				startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
        
        			}
        		});
        
        		ButtonClick2.setOnClickListener(new OnClickListener() {
        
        			@Override
        			public void onClick(View v) {
        				Calendar cal = Calendar.getInstance();
        				File file = new File(Environment.getExternalStorageDirectory(),  (cal.getTimeInMillis()+".jpg"));
        				if(!file.exists()){
        					try {
        						file.createNewFile();
        					} catch (IOException e) {
        						// TODO Auto-generated catch block
        						e.printStackTrace();
        					}
        				}else{
        					file.delete();
        					try {
        						file.createNewFile();
        					} catch (IOException e) {
        						// TODO Auto-generated catch block
        						e.printStackTrace();
        					}
        				}
        				// TODO Auto-generated method stub
        				Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        				// request code
        				//cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, capturedImageUri);
        				capturedImageUri = Uri.fromFile(file);
        				startActivityForResult(cameraIntent, 1337);
        			}
        		});
        	}
        
        	@Override
        	protected void onActivityResult(int requestCode, int resultCode, Intent data) 
        	{
        		if( requestCode == CAMERA_PIC_REQUEST)
        		{
        			//  data.getExtras()
        			
        			Bitmap bitmap = null;
        			try {
        				bitmap = MediaStore.Images.Media.getBitmap( getApplicationContext().getContentResolver(),  capturedImageUri);
        			} catch (FileNotFoundException e) {
        				// TODO Auto-generated catch block
        				e.printStackTrace();
        			} catch (IOException e) {
        				// TODO Auto-generated catch block
        				e.printStackTrace();
        			}
        			image1.setImageBitmap(bitmap);
        		}
        		else if(requestCode == 1337)
        		{
        			
        			Bitmap bitmap = null;
        			try {
        				bitmap = MediaStore.Images.Media.getBitmap( getApplicationContext().getContentResolver(),  capturedImageUri);
        			} catch (FileNotFoundException e) {
        				// TODO Auto-generated catch block
        				e.printStackTrace();
        			} catch (IOException e) {
        				// TODO Auto-generated catch block
        				e.printStackTrace();
        			}
        			image2.setImageBitmap(bitmap);
        		}
        		else 
        		{
        			Toast.makeText(DVCameraActivity.this, "Picture NOt taken", Toast.LENGTH_LONG).show();
        		}
        		super.onActivityResult(requestCode, resultCode, data);
        	}
        }
        
        
        
        
        
        
        And hre is the layout file
        main.xml
        
        <?xml version="1.0" encoding="utf-8"?>
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >
        
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >
        
                <Button
                    android:id="@+id/buttonClick1"
                    android:layout_width="150dp"
                    android:layout_height="wrap_content"
                    android:text="Click for Photo1" />
        
                <Button
                    android:id="@+id/buttonClick2"
                    android:layout_width="150dp"
                    android:layout_height="wrap_content"
                    android:text="Click for Photo2" />
            </LinearLayout>
        
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >
        
                <ImageView
                    android:id="@+id/PhotoCaptured1"
                    android:layout_width="150dp"
                    android:layout_height="200dp" />
                <ImageView
                    android:id="@+id/PhotoCaptured2"
                    android:layout_width="150dp"
                    android:layout_height="200dp" />
            </LinearLayout>
            <!--
            <FrameLayout
            android:id="@+id/camera_preview"
            android:layout_gravity="center"
            android:layout_width="200dp"
            android:layout_height="200dp"
            />
            -->
        
        </LinearLayout>
    
    
    And if any1 can suggest me that what i have to do to save the captured image in the database,that will be another advantage for me.
    
    Thanks in advance..

