I have assest in which there are subfolder and files in this way ..
As show in image ..assest->www ->js or cs folder..then files
assest
|
|__www
|
|___js
| |
| |__a.js
|
|____cs
| |
| |__a.css
|
|____index.html
I need to print all files name ..can we print that files name
I make this function but not work ..
package com.mobilecem.atms;
import java.io.IOException;
import android.content.Context;
import android.util.Log;
public class GlobalFunction {
public static boolean listAssetFiles(String path,Context context) {
String [] list;
try {
list = context.getAssets().list(path);
if (list.length > 0) {
// This is a folder
for (String file : list) {
if (!listAssetFiles(path + "/" + file, context))
return false;
}
} else {
Log.d("File Name", "file present");
// This is a file
// TODO: add file name to an array list
}
}catch (IOException e) {
return false;
}
return true;
}
}
call like that
GlobalFunction.listAssetFiles("", aaa.this);
Result : list have : index.html , a.js, a css
Comment