Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Java có nhiều, nếu không, các thư viện của bên thứ ba hơn bất kỳ ngôn ngữ lập trình khác hiện đại. Các thư viện của bên thứ ba tôi đề cập đến ở đây là các tập tin JAR vô số mà bạn có thể bao gồm trong một máy chủ hoặc máy tính để bàn ứng dụng Java-những điều mà các SDK Java mình không cung cấp. | . 24 Chapter T Leveraging Java Libraries Java has as many if not more third-party libraries than any other modern programming language. The third-party libraries I m referring to here are the innumerable JAR files that you can include in a server or desktop Java application the things that the Java SDKs themselves do not provide. In the case of Android the Dalvik virtual machine VM at its heart is not precisely Java and what it provides in its SDK is not precisely the same as any traditional Java SDK. That being said many Java third-party libraries still provide capabilities that Android lacks natively and therefore may be of use to you in your project if you can get them to work with Android s flavor of Java . This chapter explains what it will take for you to leverage such libraries and the limitations on Android s support for arbitrary third-party code. The Outer Limits Not all available Java code will work well with Android. There are a number of factors to consider including the following Expected platform APIs Does the code assume a newer Java Virtual Machine JVM than the one Android is based on Or does the code assume the existence of Java APIs that ship with Java SE but not with Android such as Swing Size Existing Java code designed for use on desktops or servers does not need to be concerned much with on-disk size or to some extent even in-RAM size. Android of course is short on both. Using third-party Java code particularly when prepackaged as JARs may balloon the size of your application. Performance Does the Java code effectively assume a much more powerful CPU than what you may find on many Android devices Just because a desktop can run it without issue doesn t mean your average mobile phone will handle it well. 245 CHAPTER 24 Leveraging Java Libraries Interface Does the Java code assume a console interface Or is it a pure API that you can wrap your own interface around One trick for addressing some of these concerns is to use open source Java code and