Hello, ๋‚˜๋‚˜'s world !

ERROR: Can't convert object of type java.lang.String to type ๋ณธ๋ฌธ

๐Ÿ”จ์‚ฝ์งˆ์ผ๊ธฐ

ERROR: Can't convert object of type java.lang.String to type

Nana0 2021. 1. 18. 19:24

RecyclerView์— ํŒŒ์ด์–ด๋ฒ ์ด์Šค ๋ฐ์ดํ„ฐ๋ฅผ ์—…๋กœ๋“œ ํ•˜๋Š” ๊ณผ์ •์—์„œ ์—๋Ÿฌ๊ฐ€ ์ƒ๊ฒผ๋‹ค.

๊ฐ€๋งŒ๋ณด๋‹ˆ ํƒ€์ž…์ด ์•ˆ๋งž์•„์„œ ์ƒ๊ธด ์—๋Ÿฌ๊ฐ™๋‹ค. String ์œผ๋กœ ํ˜ธ์ถœํ•˜๋Š”๊ฒƒ์ด ์•ˆ๋งž๋Š”๊ฒƒ ๊ฐ™์•„์„œ ์ฐพ์•„๋ดค๋‹ค.

 

 

์ฝ”๋“œ์™€ ํŒŒ์ด์–ด๋ฒ ์ด์Šค DB ๋…ธ๋“œ์ฐฝ์„ ๋ณด์•˜๋‹ค.

 

<ํŒŒ์ด์–ด๋ฒ ์ด์Šค DB๋…ธ๋“œ>

 

 

        mFamRef = FirebaseDatabase.getInstance().getReference("Family").child(TEST_FAMILY).child("LetterContants").child("2021-01-18-03-59-35");
        mFamRef.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot snapshot) {
                if(snapshot.exists()){
                    for(DataSnapshot npsnapshot : snapshot.getChildren()){
                        LetterList al = npsnapshot.getValue(LetterList.class);
                        itemList.add(al);
                    }
                    letterListAdapter = new LetterListAdapter(itemList);
                    recyclerView.setAdapter(letterListAdapter);
                }
            }

 

 

.child("2021-01-18-03-59-35") ๋ฅผ ์ง€์›Œ์ฃผ๋‹ˆ ์ž˜ ์ฝ์–ด์™€์ง„๋‹ค.

 

       //์ˆ˜์ •๋œ ์ฝ”๋“œ
        mFamRef = FirebaseDatabase.getInstance().getReference("Family").child(TEST_FAMILY).child("LetterContants");
        mFamRef.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot snapshot) {
                if(snapshot.exists()){
                    for(DataSnapshot npsnapshot : snapshot.getChildren()){
                        LetterList al = npsnapshot.getValue(LetterList.class);
                        itemList.add(al);
                    }
                    letterListAdapter = new LetterListAdapter(itemList);
                    recyclerView.setAdapter(letterListAdapter);
                }
            }

 

 

 

Comments