Java – what does the “this” context mean?

I checked many Android tutorials through the Internet In these tutorials, they use this context everywhere I know what this keyword means in Java, but I can't use this keyword in Android programming For example, in developer android. Alertdialog.com In builder, the context parameter has only one reference, but I can't understand what this means

Solution

If you have an activity, you can use it because:

>This is the current instance of a class > an activity inherits from the "context" class

This allows you to use the current activity as a context

See here for acitivty documentation

And here

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>