What's up with different contexts in android? [duplicate]
What's the difference between myClass.this and getBaseContext? When I put an AlertDialog in a different class and instantiate it, I can only get the dialog to show if I use myClass.this from the parent class. I thought getBaseContext() did the same thing but I guess not. What am I missing?
I believe you should look here first: Diffinitive rules for using Android's getBaseContext, getApplicationContext or using an Activity's “this”
"this" refers to what method you're in, and "getBaseContext/getApplicationContext" refers to the Activity you're in.
精彩评论