title: How to Capture image from Camera Application in Android Programming?
body: <p>I am trying to implement Camera application in android,and i got some code from net to create a Live Camera through WebCam.Upto this no problem.Now i have to capture the images when click the button, and i displayed the captured images in the Dialog window.Without any exception the program is running but the captured image is not displayed,some default image is displayed.</p>
  
  <p>My code is</p>
  
  <pre><code>public void captureImage()
  {
      Camera.Parameters params = camera.getParameters();
      camera.setParameters(params);
      Camera.PictureCallback jpgCallback = new PictureCallback() 
      {
          public void onPictureTaken(byte[] data, Camera camera) 
          {
              try
              {
                  Dialog d=new Dialog(c);
                  d.setContentView(0x7f030000);
                  BitmapFactory.Options opts = new BitmapFactory.Options();
                  Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length,opts);
                  TextView tv=(TextView)d.findViewById(0x7f050001);
                  ImageView i=(ImageView)d.findViewById(0x7f050000);
                  i.setImageBitmap(bitmap);
                  tv.setText("Hai"+data.length);
                  d.show();
              }
              catch(Exception e)
              {
                  AlertDialog.Builder alert=new AlertDialog.Builder(c);
                  alert.setMessage("Exception1"+e.getMessage());
                  alert.create();
                  alert.show();
              }
          }
  
      };
      camera.takePicture(null, null, jpgCallback);
  }
  </code></pre>
  
  <p>I have no idea from where this default image is coming,i don't how to slove this problem.Anyone knows about this please help me.Waiting for the Reply.....</p>