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

Crashing at MainActivity #9

Open
raviraghav93 opened this issue Jan 31, 2016 · 5 comments
Open

Crashing at MainActivity #9

raviraghav93 opened this issue Jan 31, 2016 · 5 comments

Comments

@raviraghav93
Copy link

My app is crashing with logcat showing nullpointer exception and taking me to this line in MainActivity

mSheetLayout.setFab(mFab);

FYI i'm using eclipse
Please Help.

@DarkNormal
Copy link

mSheetLayout or mFab is probably null, can you post your onCreate method where you initialize them?

@raviraghav93
Copy link
Author

Here is my oncreate method.

public class MainActivity extends BaseActivity implements SheetLayout.OnFabAnimationEndListener {

@Bind(R.id.bottom_sheet)
SheetLayout mSheetLayout;
@Bind(R.id.fab)
FloatingActionButton mFab;
@Bind(R.id.list_mails)
ListView listMails;

ArrayList<Mail> mailList;

private static final int REQUEST_CODE = 1;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    mailList = new ArrayList<Mail>();

    setUpToolbarWithTitle(getString(R.string.INBOX), false);

    mSheetLayout.setFab(mFab);
    mSheetLayout.setFabAnimationEndListener(this);

    fillMailList();
    listMails.setAdapter(new MailAdapter());
}

@DarkNormal
Copy link

It looks fine to me, unless the SheetLayout / FAB are not present in R.layout.activity_main or have the wrong IDs. Have you tried it without binding via findViewByID?

@raviraghav93
Copy link
Author

yeah i did
it still giving me null pointer exception at
mSheetLayout.setFab(mFab);

@DarkNormal
Copy link

@raviraghav93 do you have your code available on Github? I could take a proper look rather than guessing on the supplied info

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

2 participants