greenDAO icon indicating copy to clipboard operation
greenDAO copied to clipboard

Android getActivity, getContext, getView in fragment is undefined

Open xvjianzhe opened this issue 9 years ago • 4 comments

stackoverflow Android getActivity, getContext, getView in fragment is undefined

xvjianzhe avatar Jan 20 '17 08:01 xvjianzhe

Have you defined your entities inside of WelcomeFragment? Try to define them each in their own class. -ut

greenrobot-team avatar Jan 23 '17 14:01 greenrobot-team

No response. Closing. -ut

greenrobot-team avatar Mar 21 '17 07:03 greenrobot-team

I have the same problem. I do not understand, what do you mean by "define your entities inside of Fragment"? If they are imported?

jmmarko avatar Mar 22 '17 10:03 jmmarko

I just found out that in my case the problem was that I had "import org.greenrobot.greendao.annotation.ToMany;" under imports. It was never used in the code, but it was a reason for "getActivity() undefined" error. So I guess in your case the problem is NotNull annotation.

jmmarko avatar Mar 22 '17 10:03 jmmarko