I am using dialog fragment,
when I click on fab i will display the dialog , but I have to setCanceledOnTouchOutside
when I do the app is crashing !
so , how I can stop touch out side
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FragmentManager fm = getSupportFragmentManager();
addAction add = new addAction();
add.getDialog().setCanceledOnTouchOutside(false);
add.show(fm,"fragment_edit_name");
}});
and i got this error
09-26 13:06:21.997 2890-2890/com.example.todo.todoapplication E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NullPointerException
at com.example.todo.todoapplication.MainActivity$2.onClick(MainActivity.java:94)
line 94 is add.getDialog().setCanceledOnTouchOutside(false);