I have the following code in JAVA:
byte[] data = new byte[1024];
int count;
int total = 0;
while ((count = input.read( data )) != -1) {
output.write( data, 0, count );
total += count;
publishProgress((int) (total * 100 / sizeFichero));
}
I am updating my app to Kotlin, but in the WHILE, I have an error.
In this piece of code, I get the following error:
Assignments are not expressions, and only expressions are allowed in this context
val data = ByteArray(1024)
var count: Int?
var total = 0
while ((count = input.read(data)) != -1) {
output.write( data, 0, count!! )
total += count!!
publishProgress((int) (total * 100 / sizeFichero));
}
Any suggestions to eliminate the error.