Skip to content

Commit f4ab8b5

Browse files
committed
Update AsyncHttpResponseHandler.java
fix onProgress method's log about progress always 0% because bytesWritten's type is int and totalSize 's type is int ;int/int is 0
1 parent 10a2878 commit f4ab8b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public AsyncHttpResponseHandler() {
185185
* @param totalSize total size of file
186186
*/
187187
public void onProgress(int bytesWritten, int totalSize) {
188-
Log.v(LOG_TAG, String.format("Progress %d from %d (%d%%)", bytesWritten, totalSize, (totalSize > 0) ? (bytesWritten / totalSize) * 100 : -1));
188+
Log.v(LOG_TAG, String.format("Progress %d from %d (%2.0f%%)", bytesWritten, totalSize, (totalSize > 0) ? (bytesWritten*1.0 / totalSize) * 100 : -1));
189189
}
190190

191191
/**

0 commit comments

Comments
 (0)