I have this following class call inside the main is working perfectly single problem is for me to setar the image I received in the msg of the following error
E / AndroidRuntime: FATAL EXCEPTION: Thread-201 android.view.ViewRootImpl $ CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
class LooperThread extends Thread {
@Override
public void run() {
try {
while (true) {
System.out.println("entro");
Fila fila = new Fila("NocView", "NocView-Campainha", TipoFila.Get, "rabbit01.spacnet.com.br", "campainha", "campainha");
byte[] teste = fila.consome();
Mensagem m = new Mensagem().getObjeto(teste);
Campainha campainha2 = (Campainha) m;
fila.ack();
InputStream in = new ByteArrayInputStream(campainha2.getImagem());
Drawable d = Drawable.createFromStream(in, "src name");
byte[] data = campainha2.getImagem();
Bitmap bmp = BitmapFactory.decodeByteArray(campainha2.getImagem(), 0, campainha2.getImagem().length);
img.setImageBitmap(bmp); -> erro
}
}
How could you be solving this problem?