Scanning all I guess it may have some side effects in terms of efficiency
Java code
- Public void systemscan (){
- Sendbroadcast (new intent (intent. action_media_mounted, Uri. parse ("file ://"
- + Environment. getexternalstoragedirectory ())));
- }
-Scan a file parameter: Enter the file path.
Java code
- Public void filescan (string file ){
- Uri DATA = URI. parse ("file: //" + file );
- Sendbroadcast (new intent (intent. action_media_scanner_scan_file, data ));
- }
-Scan folder parameters: Enter the folder path
Java code
- Public void filescan (string file ){
- Uri DATA = URI. parse ("file: //" + file );
- Sendbroadcast (new intent (intent. action_media_scanner_scan_file, data ));
- }
- Public void folderscan (string path ){
- File file = new file (PATH );
- If (file. isdirectory ()){
- File [] array = file. listfiles ();
- For (INT I = 0; I <array. length; I ++ ){
- File F = array [I];
- If (F. isfile () {// file type
- String name = f. getname ();
- If (name. Contains (". MP3 ")){
- Filescan (F. getabsolutepath ());
- }
- }
- Else {// folder type
- Folderscan (F. getabsolutepath ());
- }
- }
- }
- }