Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

NullPointerException in SocialNetwork.<init> #52

Open
dunknown opened this issue Nov 18, 2014 · 5 comments
Open

NullPointerException in SocialNetwork.<init> #52

dunknown opened this issue Nov 18, 2014 · 5 comments

Comments

@dunknown
Copy link

I get a NullPoineterEcxeption when I try to instantiate a SocialNetwork.

VkSocialNetwork vk = new VkSocialNetwork(new Fragment(), VK_APP_ID, vkScope);
 java.lang.NullPointerException
            at com.github.gorbin.asne.core.SocialNetwork.<init>(SocialNetwork.java:127)
            at com.github.gorbin.asne.vk.VkSocialNetwork.<init>(VkSocialNetwork.java:142)

Since I don't use any fragments in my app, I've created a separate class for working with ASNE, so I can't pass "this" as first parameter (like in your tutorial) and I've decided to just create a new Fragment. But it doesn't seem to work. I've also tried passing mSocialNetworkManager fragment as first parameter and got the same exception.

@dunknown dunknown changed the title NullPointerException in SocailNetwork.<init> NullPointerException in SocialNetwork.<init> Nov 18, 2014
@gorbin
Copy link
Owner

gorbin commented Nov 19, 2014

I was in the hospital and could not keep track of the project or fix anything but for now I'm fine and very grateful to you for the issues. I am very interested in this project and will develop it further.

Interesting, will check it.

@ChrisMCMine
Copy link

Same happens for me, tested with Google Plus and Twitter using 0.3.3

@gorbin
Copy link
Owner

gorbin commented Nov 23, 2014

Working on it, I can reply it only for new Fragment()
AnySocialNetwork any = new AnySocialNetwork(new Fragment(), someKeys, someScope);

@ChrisMCMine
Copy link

My guess is that this happens because onAttach(Activity activity) of the new fragment is not called yet (since it's just created and to new) and thus getActivity() in SocialNetwork.java:127 returns null which causes a NPE

@r3dh4nd5
Copy link

Any progress on this, possible workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants