INNER CODE UNIT · Java
CommonUtils
githubhaohao/NDK_OpenGLES_3_0 · app/src/main/java/com/byteflow/app/CommonUtils.java:10
public class CommonUtils {
private static final String TAG = "CommonUtils";
public static void copyAssetsDirToSDCard(Context context, String assetsDirName, String sdCardPath) {
Log.d(TAG, "copyAssetsDirToSDCard() called with: context = [" + context + "], assetsDirName = [" + assetsDirName + "], sdCardPath = [" + sdCardPath + "]");
try {
String list[] = context.getAssets().list(assetsDirName);
if (list.length == 0) {
InputStream inputStream = context.getAssets().open(assetsDirName);
byte[] mByte = new byte[1024];
int bt = 0;
File file = new File(sdCardPath + File.separator
+ assetsDirName.substring(assetsDirName.lastIndexOf('/')));
if (!file.exists()) {
file.createNewFile();
} else {
return;
}