diff --git a/app/src/main/java/com/example/cosmosclient/views/CreateGroupActivity.java b/app/src/main/java/com/example/cosmosclient/views/CreateGroupActivity.java index f8813ed..d83bf9e 100644 --- a/app/src/main/java/com/example/cosmosclient/views/CreateGroupActivity.java +++ b/app/src/main/java/com/example/cosmosclient/views/CreateGroupActivity.java @@ -25,9 +25,9 @@ super.onCreate(savedInstanceState); setContentView(R.layout.activity_make_group); + //各種IDを取得 final EditText groupNameText = findViewById(R.id.groupNameText); Button createGroupButton = findViewById(R.id.createGroupButton); - String name; final String uId,token; //グループ作成に必要な情報の取得 @@ -45,6 +45,7 @@ //interfaceから実装を取得 final GroupsRest createGroupService = retrofit.create(GroupsRest.class); + //グループ作成ボタン処理 createGroupButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view){ @@ -55,6 +56,7 @@ @Override public void onResponse(Call call, Response response) { if (response.isSuccessful()) { + //成功時 Group result = response.body(); // //確認用 @@ -63,35 +65,29 @@ // System.out.println(result.getRequests()); // System.out.println(result.getUri()); - Toast.makeText(CreateGroupActivity.this, "グループを作成しました", Toast.LENGTH_SHORT).show(); - + Toast.makeText(CreateGroupActivity.this, + "グループを作成しました", Toast.LENGTH_SHORT).show(); finish(); - } else { + //onFailureでキャッチできない用のエラー System.out.println(""); - Toast.makeText(CreateGroupActivity.this,"通信エラー",Toast.LENGTH_SHORT).show(); + Toast.makeText(CreateGroupActivity.this, + "通信エラー",Toast.LENGTH_SHORT).show(); } } @Override public void onFailure(Call call, Throwable t) { + //失敗時 t.printStackTrace(); - Toast.makeText(CreateGroupActivity.this,"グループ作成失敗",Toast.LENGTH_SHORT); + Toast.makeText(CreateGroupActivity.this, + "グループ作成失敗",Toast.LENGTH_SHORT); } }); }catch(Exception e){ e.printStackTrace(); } - } }); - - - - - - - - } }