开发者

What is the applicationcontext in makeTest() Method, please explain with the following snippet

开发者 https://www.devze.com 2023-01-05 16:26 出处:网络
Toast.makeTes开发者_StackOverflow中文版t(HelloGridView.this,\"Text to be displayed\",Toast.LENGTH.SHORT).show();
Toast.makeTes开发者_StackOverflow中文版t(HelloGridView.this,"Text to be displayed",Toast.LENGTH.SHORT).show();

What is the 'HelloGridView.this' refers? why it is called as appliactioncontext?


It's called context because HelloGridView.this (Activity class) extends the Context class (not directly, but it extends another class, which extends another, which in turn extends the Context class).

It's a grand grand child of the Context class.

0

精彩评论

暂无评论...
验证码 换一张
取 消