Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am working on Recycle bin in Smartphones. I want to know what is the technical logic behind working of Recycle bin. I also want to know how can i develop a Recycle bin in Java.
Posted

Set up a Hashmap with the files that have to be deleted (or are at least on the list for that reason).

Problem you'll face is to only get an OS like behavior to just show the files that are NOT on that list when browsing files...
 
Share this answer
 
Further to Torsten's answer, you'll need to intercept the OS level delete event, this I don't know if you can do.

Assuming your Java process can catch a file delete, it shouldn't be overly difficulty.
Instead of deleting the files, just move them to a new directory [maybe called recycle bin].
To avoid name conflicts, I would rename them with a unique id and store the original details [name, folder, date of delete] in an index file.
 
Share this answer
 
Comments
Navdeep Kumar Jain 25-Jan-12 17:09pm    
First of all thanks for you answers Sir.
Sir, i also want to compress deleted files while moving them to Recycle bin folder/directory. We have methods, but they are not efficient one. Can you please suggest us a good solution, because we need to have different compression technique for different kind of files(say text, video, etc).
Thank You
TorstenH. 26-Jan-12 4:30am    
That does not make sense - why do you need different compressings?
Treat the files like binary files, not like the type of file they are.
Those are files stored on a disc - you should be able to use the same compressing on all of them.
Nagy Vilmos 26-Jan-12 4:40am    
Not quite true. Different algorithms work better for different data types. However, as I've suggested, a good library will take the problem away and do the best job whatever the data type.
Nagy Vilmos 26-Jan-12 4:38am    
To be honest, pick a compression library and use that as it's not worth implementing it yourself. A good algorithm will take into account what the type of data is that is being compressed.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900