Click here to Skip to main content
11,581,397 members (58,632 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java Android file
How to delete the files from external storage using java code in android?
Posted 3-Jun-13 20:59pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hello Suma,

Make sure the manifest file for your app contains following permission entries then you can use the code given below to delete a file from external storage.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Code for Deletion
File file = new File(YOUR_FILE_PATH);
boolean isSuccess = file.delete();
Regards,
  Permalink  
Comments
_Amy at 4-Jun-13 4:18am
   
+5! I just added few links which will explain about storage option in Android. Please see the solution below.
Maciej Los at 4-Jun-13 5:09am
   
Agree! +5
Prasad Khandekar at 4-Jun-13 5:27am
   
Thank's Maciej.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I agree with Prasad in Solution 1[^]. I am adding few links which will explain you about storage option in android.
Storage Options[^]
Android Environment[^]


--Amit
  Permalink  
Comments
Maciej Los at 4-Jun-13 5:09am
   
+5!
_Amy at 4-Jun-13 5:10am
   
Thanks Maciej. ;)
Prasad Khandekar at 4-Jun-13 5:28am
   
Thank's Amy for providing additional info. +5.
_Amy at 4-Jun-13 5:30am
   
Thank You Prasad. :)
suma from bangalore at 4-Jun-13 5:59am
   
Thank you Prasad:-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 340
1 Sergey Alexandrovich Kryukov 155
2 virusstorm 114
3 Frankie-C 105
4 RyanDev 84
0 OriginalGriff 1,273
1 Sergey Alexandrovich Kryukov 895
2 Abhinav S 597
3 F-ES Sitecore 500
4 Suvendu Shekhar Giri 433


Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 4 Jun 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100