I am developing an Android app that needs to know the network performance such as latency, bandwidth and so on. I am wondering whether there is already such an library so that I can directly cooperate it into my code and I don't need to implement it on my own.
Any recommendations will be appreciated. Thanks.
You can take a look at Mobilyzer, it is an open source mobile measurement library for Android apps. It supports a rich set of measurements including ping, tcp throughput, udp burst, dns look up and so on. Mobilyzer has a very easy to use API. For example, you can issue a ping measurement and retrieve the results within ~10 lines of code.
You can have a look at their webpage here to get more information. The source code of Mobilyzer can be found on GitHub