Comparison of Java and Android API

Comparison of Java and Android API

This article compare the Java and Android API and virtual machine machines.

While most Android applications are written in Java, there are many differences between the java API and the Android API, and Android does not use a Java Virtual Machine but another one called Dalvik.

Contents

Virtual machine

There is no Java Virtual Machine in the platform and Java byte code is not executed. Java classes are compiled into Dalvik executables and run on Dalvik, a specialized virtual machine designed specifically for Android. Unlike Java VMs, which are stack machines, the Dalvik VM is a register-based architecture.

Dalvik has some specific characteristics that differentiate it from other standard VMs:[1]

  • The VM was slimmed down to use less space
  • The constant pool has been modified to use only 32-bit indexes to simplify the interpreter
  • Standard Java bytecode executes 8-bit stack instructions. Local variables must be copied to or from the operand stack by separate instructions. Dalvik instead uses its own 16-bit instruction set that works directly on local variables. The local variable is commonly picked by a 4-bit 'virtual register' field.

Moreover, according to Google, Dalvik has been designed so that a device can run multiple instances of the VM efficiently.[2]

Class library

Dalvik does not align to Java SE nor Java ME class library profiles[3][4] (e.g., Java ME classes, AWT or Swing are not supported). Instead it uses its own library[5] built on a subset of the Apache Harmony Java implementation.

Graphics and Widget library

Android does not use the Abstract Window Toolkit nor the Swing library. User Interface is built using View objects. Android use a framework similar to Swing based around Views rather than JComponents. However, Android widgets are not JavaBeans: the Android application Context must be provided to the widget at creation.

Look and Feel

Android widget library does not support a Pluggable look and feel architecture; The Look and Feel of Android widgets must be embedded in the widgets themselves. There is however a limited capability to set styles and themes for an application.[6]

Layout manager

Contrary to Java where Layout managers can be applied to any container widget, Android layout behavior is encoded in the containers.[7]

See also

References

  1. ^ Rose, John (2008-05-31). "with Android and Dalvik at Google I/O". http://blogs.sun.com/jrose/entry/with_android_and_dalvik_at. Retrieved 2008-06-08. 
  2. ^ Google (2009-04-13). "What is Android?". http://developer.android.com/guide/basics/what-is-android.html. Retrieved 2009-04-19. 
  3. ^ "Google's Android SDK Bypasses Java ME in Favor of Java Lite and Apache Harmony". infoq.com. 2007-11-12. http://www.infoq.com/news/2007/11/android-java. Retrieved 2009-05-31. "Instead of providing a full version of the Java SE or Java ME Google has diverged on two fronts. First, a limited subset of the core Java packages is provided. (...) By going this route Android is following in the footsteps of another Google project GWT which uses Java as its development language but does not support the full JDK." 
  4. ^ "Alternative to Point2D". Droid Tutorials. 2010-02-12. http://droidtutorials.blogspot.com/2010/02/alternative-to-point2d.html. Retrieved 2010-02-17. "Given that AWT is not supported in Android API, the Point2D class, which is useful for writing 2D graphics, is missing either." 
  5. ^ "Package Index". Google. http://developer.android.com/reference/packages.html. Retrieved 2009-05-31. 
  6. ^ "Applying Styles and Themes". Google. http://developer.android.com/guide/topics/ui/themes.html#ApplyAStyle. Retrieved 2011-09-03. 
  7. ^ "Common Layout Objects". Google. http://developer.android.com/guide/topics/ui/layout-objects.html. Retrieved 2011-09-03. 

Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Comparison of the Java and .NET platforms — Contents 1 Legal issues 1.1 Standardization 1.2 License 1.2.1 Java 1.2.2 .NET …   Wikipedia

  • Comparison of OpenGL and Direct3D — Direct3D and OpenGL are competing application programming interfaces (APIs) which can be used in applications to render 2D and 3D computer graphics, taking advantage of hardware acceleration when available. Modern graphics processing unit (GPUs)… …   Wikipedia

  • Comparison of C Sharp and Java — The correct title of this article is Comparison of C# and Java. The substitution or omission of the # sign is because of technical restrictions. Programming language comparisons General comparison Basic syntax Basic instructions …   Wikipedia

  • Comparison of relational database management systems — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • Android — Parte de la familia Linux …   Wikipedia Español

  • Comparison of TLS Implementations — The Transport Layer Security (TLS) protocol provide the ability to secure communications across networks. There are several TLS implementations which are free and open source software and sometimes choosing between the available implementations… …   Wikipedia

  • Comparison of time tracking software — This is a comparison of notable time tracking software packages and web hosted services. Name Platform Features Integration Data storage Licensing 1DayLater Web based Online time tracking and invoicing tool. Includes expense tracking, mileage… …   Wikipedia

  • Comparison of geographic information systems software — This is a comparison of notable GIS software. To be included on this list, the software must either have a linked existing article or include references to independent sources verifying notability. Contents 1 License, source, operating system… …   Wikipedia

  • Comparison of WebSocket implementations — Contents 1 Comparison of WebSocket Implementations 1.1 Rationale 1.2 Table of WebSocket implementations 2 Notes …   Wikipedia

  • Comparison of agent-based modeling software — In the last few years, the agent based modeling (ABM) community has developed several practical agent based modeling toolkits that enable individuals to develop agent based applications. More and more such toolkits are coming into existence, and… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”