Note that there are some explanatory texts on larger screens.

plurals
  1. PODelete copy of an image in sdcard
    text
    copied!<p>Hello friends I am using the following code in my my project.</p> <p>PERMISSIONS:</p> <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.CAMERA"/&gt; </code></pre> <p>XML FILE:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Camera Test" /&gt; &lt;ImageView android:id="@+id/camera_image" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Code(Java File):</p> <pre><code>public class ImageInfo extends Activity { private static final int CAMERA_PIC_REQUEST = 1111; private ImageView mImage; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mImage = (ImageView) findViewById(R.id.camera_image); //1 Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, CAMERA_PIC_REQUEST); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(resultCode != RESULT_CANCELED) { if(requestCode == CAMERA_PIC_REQUEST){ //2 System.out.println("Request"+requestCode+"result"+resultCode); Bitmap thumbnail = (Bitmap) data.getExtras().get("data"); // mImage.setImageBitmap(thumbnail); //3 ByteArrayOutputStream bytes = new ByteArrayOutputStream(); thumbnail.compress(Bitmap.CompressFormat.JPEG, 100, bytes); //4 File file = new File(Environment.getExternalStorageDirectory()+"/saved_images/image.jpeg"); try { file.createNewFile(); FileOutputStream fo = new FileOutputStream(file); //5 fo.write(bytes.toByteArray()); fo.close(); Intent intent=new Intent( this,Info.class); startActivity(intent); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } </code></pre> <p>I am successfully able to operate the camera and take images butan extra copy of image is being created in the DCIM directory (deafult directory) of android by name_date.jpg Please help in deleting all these files. Thanks &amp; regards.....</p>
 

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