SwitchCompat xml을 drawer메뉴에서 참조를 해서 drawer에 나오게 설정이 되어있는데요.
자바 코드상에서 OnCheckedListner를 등록하는 부분에서 NullPointerException이 뜹니다.
코드는 밑에 첨부했구요 ㅠ
왜이러는지좀 알수 있을까요??
제가 검색한거로는 textOn과 Off를 설정해주면 된다고해서 다 넣어봤는데도
계속해서 에러가 뜹니다 ㅠ 일반 Switch로해도 마찬가지입니다..
<android.support.v7.widget.SwitchCompat
android:id="@+id/noticeSwitch"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textOn="On"
android:textOff="Off"/>
<menu>
<item
android:id="@+id/nav_switch"
android:icon="@drawable/ic_menu_send"
app:actionLayout="@layout/action_view_switch"
android:title="공고 알림 설정"/>
</menu>
noticeSwitch = (SwitchCompat) findViewById(R.id.noticeSwitch);
noticeSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {