Hi guys I am using apache.commons.net to upload my files from sd card to a ftp server created by file zilla. However, all I want to do is to show the progress to the users. Could you please help me? here is my code:
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
There is a problem with this line:
Since totalBytesTransferred is long and File.length() returns long, and integer division will be performed. So this line will return zero until totalBytesTransferred equals file.length(). It will then return 100.
You could cast totalBytesTransferred to double before dividing like this to get the percentage:
if in case you never solve your problem yet. I think the problem is within this line publishProgress
((int) ((totalBytesTransferred/file.length())*100))
instead try this
On line 322 of your paste.
This I suspect is where its failing! If you're not getting any logcat with the string "CopyStreamAdapter", it means your handler in this is not getting fired!