diff --git a/app/src/main/java/com/example/citrusclient/views/CreateBookFragment.java b/app/src/main/java/com/example/citrusclient/views/CreateBookFragment.java index e8c6ade..3ed197e 100644 --- a/app/src/main/java/com/example/citrusclient/views/CreateBookFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/CreateBookFragment.java @@ -1,7 +1,5 @@ package com.example.citrusclient.views; -import android.app.Dialog; -import android.app.AlertDialog; import android.content.Intent; import android.content.DialogInterface; //import android.support.v4.app.DialogFragment; @@ -94,7 +92,7 @@ @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); //親クラスである Fragment の onViewCreated() メソッドを呼び出す - Citrus citrus = (Citrus) (getActivity().getApplication()); + Citrus citrus = (Citrus)(getActivity().getApplication()); String token = citrus.getToken(); String accountId = citrus.getAccountId(); //ここから書く @@ -135,10 +133,15 @@ // String textbook = textbookname.getText().toString().trim(); //本を保存するコードを書く? - booksViewModel.createBook("bird", bookname, "#00FF00", true, "xyz"); //BooksViewModelを呼び出して本を作る + String accountId = ((Citrus) getActivity().getApplication()).getAccountId(); + String token = ((Citrus) getActivity().getApplication()).getToken(); + + booksViewModel.createBook(accountId, bookname, "#00FF00", true, token); //BooksViewModelを呼び出して本を作る //画面が本棚に戻る + + ((MainActivity) getActivity()).showFragment(new MyBookshelfFragment()); //本棚に戻る } }