What is 'Context' on Android?

前端 未结 30 3074
南旧
南旧 2020-11-21 04:46

In Android programming, what exactly is a Context class and what is it used for?

I read about it on the developer site, but I am unable to understand it

30条回答
  •  自闭症患者
    2020-11-21 05:14

     Context means current. Context use to do operation for current screen. ex.
      1. getApplicationContext()
      2. getContext()

    Toast.makeText(getApplicationContext(), "hello", Toast.LENGTH_SHORT).show();
    

提交回复
热议问题