Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: clicking the image in camera and show the image in dialogbox
    primarykey
    data
    text
    <p>i m using a custom dialog with an <code>ImageView</code> and 2 <code>Button</code>. </p> <ol> <li>first button to pick image from gallery</li> <li>second button to click image from camera</li> </ol> <p>i want to show the image in the <code>ImageView</code> of the dialog..</p> <pre><code>btn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Dialog(); } private void Dialog() { // TODO Auto-generated method stub final Dialog dialog=new Dialog(editevent1.this); dialog.setContentView(R.layout.promote2); ImageView image =(ImageView)findViewById(R.id.image_camera); Button d=(Button)dialog.findViewById(R.id.button2); Button f=(Button)dialog.findViewById(R.id.button3); dialog.show(); d.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, 1); } }); f.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent cameraintent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraintent, CAMERA_PIC_REQUEST); } }); } }); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if( requestCode == CAMERA_PIC_REQUEST) { Bitmap thumbnail = (Bitmap) data.getExtras().get("data"); ImageView image =(ImageView)findViewById(R.id.image_camera); image.setImageBitmap(thumbnail); } else { Toast.makeText(this, "Picture NOt taken", Toast.LENGTH_LONG); } } </code></pre> <p>please tell me how do i get the image in <code>ImageView</code> which is in <code>DialogBox</code> for both when picked from gallery and when clicked from camera. thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload