Hello,
I am new to Android and while I was studying it I found some things that are not very clear to me.
The Context class is used to load and access resources, to launch activities and so on. t
The Activity class is a subclass of the Context class.
Now what I've have reed is that a widgets in their constructors have a reference to a Context object. In the line below the AlertDialog.Builder class uses the this keyword to pass the Context reference.
AlertDialog.Builder builder = new AlertDialog.Builder(this);
My question is why is not used a reference to the Activity object? Where is instantiated the Context object?
Thank you,
Razvan
I am new to Android and while I was studying it I found some things that are not very clear to me.
The Context class is used to load and access resources, to launch activities and so on. t
The Activity class is a subclass of the Context class.
Now what I've have reed is that a widgets in their constructors have a reference to a Context object. In the line below the AlertDialog.Builder class uses the this keyword to pass the Context reference.
AlertDialog.Builder builder = new AlertDialog.Builder(this);
My question is why is not used a reference to the Activity object? Where is instantiated the Context object?
Thank you,
Razvan