diff --git a/app/src/main/java/com/example/citrusclient/views/CreateTodoFragment.java b/app/src/main/java/com/example/citrusclient/views/CreateTodoFragment.java index e63dc14..cd80709 100644 --- a/app/src/main/java/com/example/citrusclient/views/CreateTodoFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/CreateTodoFragment.java @@ -139,7 +139,7 @@ Spinner spinner = view.findViewById(R.id.select_todo_spinner); bookTitles = new ArrayList<>(); - bookTitles.add("本を選択しない"); + bookTitles.add("本を選択"); booksViewModel.getBookLiveData().observe(getViewLifecycleOwner(), new Observer>() { @Override public void onChanged(HashMap integerBookHashMap) { @@ -179,6 +179,10 @@ Snackbar.make(view, "タイトルを入力してください", Snackbar.LENGTH_SHORT).show(); return; } + if(spinner.getSelectedItem().toString().equals("本を選択")){ + Snackbar.make(view, "本を選択してください", Snackbar.LENGTH_SHORT).show(); + return; + } todosViewModel.createTodo(accountId,spinner.getSelectedItemPosition(),year,month,day,title,token); ((MainActivity)getActivity()).showFragment(new HomeFragment()); });