Reputation: 11064
I am new to Android, but I know Javascript
so I have some familiarity in Object Oriented programming.
In this line:
Resources myResources = getResources();
AnimationDrawable androidAnimation;
androidAnimation =
(AnimationDrawable)myResources.getDrawable(R.drawable.frame_by_frame);
Upvotes: 0
Views: 309
Reputation: 213243
No. androidAnimation
is not an object. It is a reference which points to an instance of AnimationDrawable
class.
In the following object creation
statement and assigment: -
MyClass obj = new MyClass();
new MyClass()
creates an object
.MyClass obj
creates a reference to that object.This is called typecasting
. This is done because, the reference type
returned by that method invocation might not be compatible with the reference type on LHS
. So, a typecast is needed to make it compatible.
For more details about these concepts, refer to JLS: -
Upvotes: 2