Android

AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?


카카오링크 개발 중 발생한 오류다. 아직 걸길이 멀구나.


Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

        at android.app.ContextImpl.startActivity(ContextImpl.java:674)

        at android.app.ContextImpl.startActivity(ContextImpl.java:661)

        at android.content.ContextWrapper.startActivity(ContextWrapper.java:331)

        at com.kakao.kakaolink.KakaoLink.sendMessage(Unknown Source)

        at com.ubicare.wellness.MainActivity.btnkakaoLInkTest(Unknown Source)

        at java.lang.reflect.Method.invoke(Native Method) 

        at android.view.View$DeclaredOnClickListener.onClick(View.java:4454) 

        at android.view.View.performClick(View.java:5205) 

        at android.view.View$PerformClick.run(View.java:21177) 

        at android.os.Handler.handleCallback(Handler.java:739) 

        at android.os.Handler.dispatchMessage(Handler.java:95) 

        at android.os.Looper.loop(Looper.java:148) 

        at android.app.ActivityThread.main(ActivityThread.java:5476) 

        at java.lang.reflect.Method.invoke(Native Method) 

        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

[해결방법]

getApplicationContext() === >  this 로 변경 하면 처리 됩니다.

Leave a Reply

error: Content is protected !!