What is difference between this and getContext(), when I say this I mean this within an Activity.
What is difference between this and getContext() , when I say this I mean
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In general there are two type of classes. Ones that extend
ContextWrapperclass (Activity,Service,Application) and those that do not extend it (likeView).If class extends
ContextWrapperthen you can usethisasContext. Such classes normally do not havegetContext()method.Those classes that do not extend
ContextWrapperbut still save and useContextnormally exposegetContext()function. And you cannot usethisasContextin such cases.And these two cases are mutually exclusive. At least I don’t recall classes that extend
ContextWrapperand havegetContextat the same time.