diff --git a/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java b/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java index 76ef2a2..21a59d0 100644 --- a/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java +++ b/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java @@ -52,7 +52,17 @@ //myName = intentMain.getStringExtra("nickname"); //-------------------------------------------------------------------------- + //RoomViewModelへのアクセス + RoomViewModel roomViewModel = new ViewModelProvider(this).get(RoomViewModel.class); + //LiveData(List)への購読 + roomViewModel.getMembersLiveData().observe(this, new Observer>() { + private List members; + @Override + public void onChanged(List members) { + + } + }); //-------------------------------------------------------------------------- @@ -111,15 +121,7 @@ TextView RoomIdText = findViewById(R.id.roomID); RoomIdText.setText(roomId); - /*roomViewModel.getMembersLiveData().observe(this, new Observer>() { - private List members; - @Override - public void onChanged(List members) { - - } - }); - - roomViewModel.start(500);*/ + roomViewModel.start(500); } @@ -130,17 +132,6 @@ startObserve(); } - //----------------------------------------------------------------- - // VMの監視開始 - private void startObserve() { - roomViewModel = new ViewModelProvider(this).get(RoomViewModel.class); - roomViewModel.getRoomLiveData().observe(this, new Observer() { - @Override - public void onChanged(RoomJson roomData) { - //新しいroomDataの処理 - } - }); - }*/ /*private getMemberInformation(){