user2377897
user2377897

Reputation: 7

ANDROID internal storage file delete/exist not working for me

First of all, I want to know if making a file without extension is okay. For example, making a file with ".txt" extendsion will make it a txt file on a computer, but I don't know it matters in android. And I noticed that when working on eclipse, I could deleted a fild with the extensions but couldn't delete a file without a extension.

I want my program to delete a file in the internal storage (com.name.application folder) but it's not working for me.

I make a file with

FileOutputStream fos = openFileOutput(FileName, MODE_PRIVATE);

write with

bos = new BufferedOutpuStream(openFileOutput(FileName,Context.MODE_APPEND)
bos.write(newVocabFile.getBytes());

and I want to delete with

FILE file = new File(fileName);
fild.delete();

I did researches on google and applied different methods to my codes, but every method did not work for me. Because .delete() does not work properly, .exist() does not work either. I tired making the mile with and without extension but both ways did not work either.

I really need to get through this in order to finish my application. Please help me

Upvotes: 0

Views: 3063

Answers (1)

Cory
Cory

Reputation: 325

You have a typo on this line

FILE file = new File(fileName);
fild.delete();

It should be

File file = new File(fileName);
file.delete();

Upvotes: 1

Related Questions