android – Cant convert object of type java.lang.String

android – Cant convert object of type java.lang.String

Try this:-

mDatabase.child(User).child(uid).child(Database).addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot Snapshot) {
                list.clear();

                    Item item = dataSnapshot.getValue(Item.class);

                    list.add(item);

                Collections.sort(list, (l1, l2) -> l1.getNama().compareTo(l2.getNama())); //buat sort alphabetically
                itemAdapter = new ItemAdapter(MainActivity.this, list);
                recyclerView.setAdapter(itemAdapter);
                progressDialog.dismiss();
            }

android – Cant convert object of type java.lang.String

Leave a Reply

Your email address will not be published. Required fields are marked *