I would like to know how to recover an image in the firebase and put it in a listview, I saw some questions here, I followed the answers that are in them but none worked. I saw that a guy said he used a recyclerView and it worked, but I could not use it, could anyone help me? below is the code
ADAPTER
public View getView(int position, View convertView, ViewGroup parent) {
View view = act.getLayoutInflater().inflate(R.layout.lista_sessao_personalizada, parent, false);
Sessoes sessao = sessoes.get(position);
TextView nome = (TextView) view.findViewById(R.id.lista_sessao_personalizada_nome);
TextView descricao = (TextView) view.findViewById(R.id.lista_sessao_personalizada_descricao);
final ImageView imagem = (ImageView) view.findViewById(R.id.lista_sessao_personalizada_imagem);
nome.setText(sessao.getNomeSessao());
descricao.setText(sessao.getDescricaoSessao());
firebase = ConfiguracaoFirebase.getFirebase().child("configuracao").child("telaInicial").child("calendario");
ValueEventListener post = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String imagemFire = dataSnapshot.getValue().toString();
Glide.with(act).load(imagemFire).into(imagem);
Log.i("imagem", imagemFire);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
firebase.addValueEventListener(post);
// Glide.with(act).load(imagemFire).into(imagem);
return view;
}
}
Activity that receives the adapter
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
logoImg = findViewById(R.id.logo_doeamor_id);
firebase = ConfiguracaoFirebase.getFirebase().child("configuracao").child("telaInicial").child("logo");
ValueEventListener post = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String imagem = dataSnapshot.getValue().toString();
Glide.with(getApplicationContext()).load(imagem).into(logoImg);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
firebase.addValueEventListener(post);
sessoes = todasAsSessoes();
listaDeSessoes = (ListView) findViewById(R.id.listaDeSessoes);
AdapterPersonalizado adapter = new AdapterPersonalizado(sessoes, MainActivity.this);
listaDeSessoes.setAdapter(adapter);
}
and the image looks like this: