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 #24

Closed
alirizagoksu opened this issue Aug 6, 2017 · 5 comments
Closed

NullPointerException #24

alirizagoksu opened this issue Aug 6, 2017 · 5 comments

Comments

@alirizagoksu
Copy link

alirizagoksu commented Aug 6, 2017

at dmax.dialog.SpotsDialog.setMessage(SpotsDialog.java:74)

@Override
public void setMessage(CharSequence message) {
        ((TextView) findViewById(R.id.dmax_spots_title)).setText(message);
}

if you set custom message after create dialog but not show dialog yet, it throws NullPointerException. Because it isn't inflated yet. This method should be like that

@Override
public void setMessage(CharSequence message) {
       this.message = message; // this is necessary if textView null
       TextView textView = (TextView) findViewById(R.id.dmax_spots_title);
       if (textView != null) {
            textView.setText(message);
       }
}
@dybarsky
Copy link
Owner

Cool, thanks

@ishaan-khan
Copy link

I believe "cool, thanks" suggests you have implemented this already. Why am I still getting this crash?

@dybarsky
Copy link
Owner

dybarsky commented Oct 4, 2017

@ishaan-khan as you can see this issue is still open

aistomin added a commit to aistomin/spots-dialog that referenced this issue Nov 19, 2017
- dmax.dialog.SpotsDialog.setMessage was fixed:
-- we set provided value to the SpotsDialog.message member;
-- if dialog is already displayed we call SpotsDialog.initMessage() logic.
@aistomin
Copy link
Contributor

aistomin commented Nov 19, 2017

@d-max I've created a fix for this issue: #27 Could you please check it and accept the PR if the implemented logic is acceptable. Thanks.
P.S. Thanks for the nice library by the way.

dybarsky added a commit that referenced this issue Nov 29, 2017
Issue #24. NullPointerException.
@dybarsky
Copy link
Owner

@aistomin Thank you for the fix 👍

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