Reputation: 3373
I know in Java there are two kinds of integers. First is "int" which is the primitive integer. The second is "Integer" which is a class with methods and stuff.
While programming for Android I saw another type: "integer" with all lowercase chars. It is declared in "android.R" namespace and there is only four static methods in it.
What is it? Why is it there? What is its relation with "int" and "Integer" (if any?)
Upvotes: 0
Views: 589
Reputation: 4276
R.integer is the integer resource file for integers defined in xml. Just like R.layout, R.style, R.id, R.string etc. Here an explanation what it is used for. Basically a <integer> </integer>
resource element in a xml file in the res/values folder.
Edit: oops you asked what the integer resource value in the android.R namespace was. In my explanation above, I explained how these are declared in your own application namecpace. The .integer resource values in the android.R namespace are the same, but are declared and used in the Android framework for animation durations.
This SO question is about what the value of the constants in android.R.integer actually is. Somewhere in the android framework there is a res/values/<name>.xml
which declares these Integer constants.
Upvotes: 1
Reputation: 2236
integer is a tag in some xml format used in android. this integer is may be animation time or something like this. When we import app.R then app.R.integer got visible.
as xml uses all lower case keywords hence instead of Integer it uses integer.
Upvotes: 0
Reputation: 13785
Integer is class, int is a primitive type.
The Integer class wraps a value of the primitive type int in an object. An object of type Integer contains a single field whose type is int.
Perhaps you may try this:
Preferences -> Java -> Code Style -> Organize Imports -> (check)
Do not create imports for types starting with a lowercase letter
I'm sure if it helps but lets give a try :)
Upvotes: -1
Reputation: 20577
These are still integers, I believe every member/method in R.class returns an integer. These however are to do with time, time of an animation to be exact. R.integer is just a class name, imo they shouldn't have named it as this as some people have imported this before instead of integer, so check your imports :)
Upvotes: 0
Reputation: 2855
Seems to have something to do with animations: http://developer.android.com/reference/android/R.integer.html
Upvotes: 1