Как объединить Master Detail и RecyclerView с Firestore? - PullRequest
0 голосов
/ 17 апреля 2020

Я не знаю, как объединить представление Master Detali и RercycerView с Firestore.

public class GameDescriptionActivity extends AppCompatActivity {
    private static final String KEY_TITLE = "title";
    private static final String KEY_WIN = "win";
    private static final String KEY_REGION = "region";

    private FirebaseFirestore db = FirebaseFirestore.getInstance();
    private CollectionReference gameCollection = db.collection("GameDescription");
    private DocumentReference gameRef0 = db.document("GameDescription/0");
    private DocumentReference gameRef1 = db.document("GameDescription/1");
    private DocumentReference gameRef2 = db.document("GameDescription/2");
    private DocumentReference gameRef3 = db.document("GameDescription/3");
    private DocumentReference gameRef4 = db.document("GameDescription/4");
    private DocumentReference gameRef5 = db.document("GameDescription/5");
    private DocumentReference gameRef6 = db.document("GameDescription/6");
    private DocumentReference gameRef7 = db.document("GameDescription/7");

    public TextView title, win, region;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_game_description);
        title = findViewById(R.id.gameTitle);
        win = findViewById(R.id.winMoney);
        region = findViewById(R.id.regionRestrictions);
    }

    @Override
    protected void onStart() {
        super.onStart();
        gameCollection.addSnapshotListener(new EventListener<QuerySnapshot>() {
            @Override
            public void onEvent(@Nullable QuerySnapshot queryDocumentSnapshots, @Nullable FirebaseFirestoreException e) {

            }
        });
    }
}

Давайте опишем мою проблему

В моем приложении я хочу показать Master Detail (с данными из документа "5") вид после нажатия на RecyclerView (в положении 5). Данные для надувания Master Detail находятся в моей базе данных Firestore . Как вы можете видеть выше, в моем GameDescriptionActivity я объявил много ссылок на документы, которые будут связаны с switch. Это мой документ Firestore Firestore с примером содержания od Master Detail. Пожалуйста, помогите, большое спасибо.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...