When programming on Android, we always use a context object (perhaps the context keyword or the this ), but I really donβt understand what its purpose is.
For example, when we add a UI Component , for example TextView :
TextView textView = new TextView(this); //this simple line make me headache setContentView(textView);
The first time I think of a line: this keyword mean: this textView will be assigned to the current screen. But after that, I see that it is wrong thinking because the setContentView(textView) does what I think.
So who can explain to me what the purpose is when we declare a context object in the above example. (and other cases, if you want, tell me more: D)
thanks:)
source share