Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

android how to remove black frame of a deleted image in the sd card folder after dele

OP refat_chowdhury@yahoo.com

15th June 2014, 03:30 PM   |  #1  
OP Junior Member
Thanks Meter: 0
 
1 posts
Join Date:Joined: Jun 2014
I am trying to delete an image file from sdcard.The following code works fine with the emulator but when I'm testing it on my Nexus phone there is a black frame exists in the folder for each deleted image.So, after following posts in relation to similar issue my code looks like below. I've just started learning android programming and got stuck at this point.I'll really appreciate your help
String sdcard_path=Environment.getExternalStorageDirector y().getAbsolutePath()+"/Expense_image";
File cacheFile =new File (sdcard_path,imageLocation);
if(cacheFile.exists()){

boolean deleted=cacheFile.delete();

Log.i("Deletion check","deleted:"+deleted);
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));


Manifest.xml
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_ST ORAGE" />

<activity
android:name=".deleteRecord"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.refat.myexpensev1.DELETERECORD" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MEDIA_MOUNTED" />
<data android:scheme="file" />
</intent-filter>
</activity>
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes