Data Type Comparison Between Elastos and Android

Primitive Data Types These are some of the primitive data types available for Android: Primitive type variables can be defined by specifying the data type, followed by the variable name, then an equal sign, and then an initial value. All Java statements end with a semicolon. For example, the following Java statement defines a variable called iVal, with an initial value of 1:
 * byte: A byte variable is an 8-bit signed integer between -128 and 127. Often used for arrays.
 * short: A short variable is a 16-bit signed integer between -32,768 and 32,767. Again, often used for arrays.
 * int: An int variable is a 32-bit signed integer between -2,147,483,648 and 2,147,483,647. This is the most commonly used “number” variable.
 * long: A long variable is a 64-bit signed integer between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807. Used when the int data type isn’t big enough.
 * float: A float variable is a single-precision 32-bit floating point number.
 * double: A double variable is a double-precision 64-bit floating point number. Use this data type for decimal values.
 * boolean: A boolean variable has only two possible values: true and false. Use this data type for conditional statements.
 * char: A char variable is a single 16-bit Unicode character.

int iVal = 1;

For a list of common Java data types, the Android reference(http://developer.android.com/reference/packages.html) includes documentation for the java.lang package. You can also find the common input/output objects in the java.io package. String Classes Android applications are written in the Java programming language. Java has a number of primitive data types for different kinds of numbers (integers, floats, etc.), Boolean values, and single characters. In addition to storing textual data as arrays or characters, Java also includes a powerful object class called String (java.lang.String), which encapsulates textual data neatly and can be used to manipulate content.

The String class is available as part of the java.lang package, which is included within the Android SDK for developers to use. The complete documentation for the String class can be found within the Android SDK documentation. The String class represents an immutable (unchangeable) sequence of Unicode (16-bit encoding) characters, appropriate for storing characters in any language (English, German, Japanese, and so on).

Time and Date Classes Android also includes numerous classes for storing, formatting and modifying date and time data for use within your Android applications. In this tutorial, you’ll learn how to determine the current date and time, store date and time/data, as well as how to display it in a number of ways. In Java, dates and times are stored in several ways, depending upon your requirements.
 * The long data type is a primitive capable of storing the number of milliseconds elapsed since a specific point in time (Unix time).
 * The Date class (java.util.Date) is a utility class, used for storing date and time in a way that can be reasonably manipulated without having to constantly think about time in terms of milliseconds.
 * The Calendar class (java.util.Calendar) is a utility class for working with different calendars, as well as for manipulating date and time information in a variety of ways.
 * The GregorianCalendar class (a subclass of java.util.Calendar) is used primarily for date manipulation in the Western hemisphere, which uses a 12-month calendar with two eras (BC and AD) and 7 days for each week.

Complex Data Structures For more complex data structures like lists, queues, stacks, dates, and times, the appropriate classes cna be found in the java.util package.

Back