FORUMS

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

1 posts
Thanks Meter: 0
 
By refat_chowdhury@yahoo.com, Junior Member on 15th June 2014, 02:30 PM
Post Reply Subscribe to Thread Email Thread
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

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes