Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Android] Flutter Plugin에서 Context 받기 #5

Open
moonyoungCHAE opened this issue Oct 20, 2019 · 0 comments
Open

[Android] Flutter Plugin에서 Context 받기 #5

moonyoungCHAE opened this issue Oct 20, 2019 · 0 comments

Comments

@moonyoungCHAE
Copy link
Member

[문제 상황]
안드로이드 SDK 함수를 사용하다보면, context가 필요할 때가 많다.
보통 Android Native 개발할 때는 this 혹은 Activity.this 이런 식으로 사용.
But Flutter에서 안됨!


[해결 방법]

  1. getApplicationContext()
    메인 Activity에서는 잘 되지만 다른 클래스에서 사용하면 null이 return된다.
  2. register에 있는 context 사용
    클래스에 register를 생성 후 mRegistrar.context() 이런 식으로 호출하면 된다.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant