Usando o Glide para carregar bitmap no ImageView
Como posso usar a biblioteca Glide para carregar o Bitmap no meu ImageView? Eu quero criar um costumeimagem com texto e carregue-o na visualização de imagens usando o Glide.
Este é o meu método para criar bitmap personalizado com texto
public Bitmap imageWithText(String text) {
TextView tv = new TextView(context);
tv.setText(text);
tv.setTextColor(Color.WHITE);
tv.setBackgroundColor(Color.BLACK);
tv.setTypeface(null, Typeface.BOLD);
tv.setGravity(Gravity.CENTER);
tv.setTextSize(20);
tv.setPadding(0, 25, 0, 0);
Bitmap testB = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(testB);
tv.layout(0, 0, 100, 100);
tv.draw(c);
return testB;
}
Mas quando tento carregar este bitmap usando glide, estou recebendo erro
Glide.with(getContext()).load(imageWithText("Random text")).into(holder.imgPhoto);