아래와 같이 위젯을 만들때에도 Context라는 구문이 상당히 많이 쓰이는데요,

Context를 왜 쓰며, 어떻게 쓰이는 것인지 궁금합니다.

대충 필요하다는 것정도만 알고 있는데, 자세히 모르고 쓰니까 너무 찝찝하네요 ㅠㅠ

Context에 대해서 아시는분 계시면 공부하는 방법이라던가, 공부할 때 쓸 책이라던가, 사이트좀

가르쳐 주셧으면 너무 감사하겠습니다. ^^


class SoundEditWidget extends EditText{
 SoundPool mPool = null;
 int mClick;
 
 public SoundEditWidget(Context context){
  super(context);
  init(context);
 }
 
 public SoundEditWidget(Context context, AttributeSet attrs){
  super(context, attrs);
  init(context);
 }
 
 public SoundEditWidget(Context context, AttributeSet attrs, int defStyle){
  super(context, attrs, defStyle);
  init(context);
 }
 void init(Context context){
  mPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
  mClick = mPool.load(context, R.raw.click, 1);
 }
 
 protected void onTextChanged(CharSequence text, int start, int before, int after){
  if(mPool != null){
   mPool.play(mClick, 1, 1, 0, 0, 1);
  }
 }
}
profile