I ask this question to know how to copy the contents of a file that is in the Assets folder but my error method because I should at least return a true value, but it does not return anything nor does it come to load My code:
//Este es el método que hago mención desde un boton y el botón funciona
private boolean Copiar55(File a , File b, File c) throws IOException{
final int CHUNK_SIZE = 1024 * 4;
InputStream is=getAssets().open("texto1.txt");
OutputStream os = new BufferedOutputStream(new FileOutputStream(a));
byte[] chunk = new byte[CHUNK_SIZE];
int bytesLeidos = 0;
while ( (bytesLeidos = is.read(chunk)) > 0) {
os.write(chunk, 0, bytesLeidos);
}
os.close();
String si="si";
InputStream is1=getAssets().open("texto2.txt");
OutputStream os1 = new BufferedOutputStream(new FileOutputStream(b));
byte[] chunk1 = new byte[CHUNK_SIZE];
int bytesLeidos1 = 0;
while ( (bytesLeidos1 = is1.read(chunk1)) > 0) {
os.write(chunk1, 0, bytesLeidos1);
}
os1.close();
InputStream is2=getAssets().open("texto3.txt");
OutputStream os2 = new BufferedOutputStream(new FileOutputStream(b));
byte[] chunk2 = new byte[CHUNK_SIZE];
int bytesLeidos2 = 0;
while ( (bytesLeidos2 = is2.read(chunk1)) > 0) {
os.write(chunk2, 0, bytesLeidos2);
}
os2.close();
return true;
}
//Esto es lo que utilizo para llamar a mi método desde el boton
if(Copiar55(a,b,c)){
}
If you notice where you fail or know another way. Please let me know.