2 Answers 2
this refers to the current object, which is probably the Activity. Activity extends Context, and it is passed as Context to the Button constructor.
answered Nov 27, 2011 at 8:06
MByD
138k30 gold badges269 silver badges278 bronze badges
Sign up to request clarification or add additional context in comments.
6 Comments
wagashi
I see. Would it be fine if I omit (this)?
MByD
No! you need to pass the context to the Button constructor
wagashi
Ok. May I write other words in parenthesis? If yes, what would they mean?
MByD
I think it is better that you explain the whole problem (in a new question) please add relevant code, and the error that you have. This way is kind of cryptic.
wagashi
Oh, no, I don't program anything with Java right now. When I read such code, and I don't find explanation on it, I just wonder what it is like and what is its equivalent in Objective-C?
|
Its a reference to the Context
answered Nov 27, 2011 at 8:06
Dmytro Danylyk
19.8k11 gold badges65 silver badges68 bronze badges
1 Comment
wagashi
I see. Would it be fine if I omit (this)?
lang-java