Ver la Versión Completa : fondo layout
gohan0189
08/05/12, 17:10:35
como podria hacerle para que por ejemplo cada 8 segundos se fuera cambiando la imagen de fondo de mi layout, podrian darme una idea si se puede con un ejemplo mucho mejor
gohan0189
08/05/12, 19:39:15
noo'?? nadieee???
kriogeN
08/05/12, 19:43:28
Puedes hacerlo con un AsyncTask o con un Thread que tenga un Handler para actualizar la pantalla.
gohan0189
08/05/12, 19:47:33
pero como ir metiendo diferentes imagenes?
gohan0189
08/05/12, 19:49:10
y no tendras un ejemplo con AsyncTask???
gohan0189
08/05/12, 20:46:55
Fatal exception: thread-9
gohan0189
08/05/12, 21:02:57
me sale ese error
FATAL EXCEPTION: Thread-9
ERROR java.lang.NullPointerException
gohan0189
08/05/12, 21:43:44
e4sto es lo que tengo
Thread thread = new Thread(){
@Override
public void run()
{
while(imagen=true)
{
try{
x=x+1;
if (x<=10){
res = getResources(); //resource handle
drawable = res.getDrawable(R.drawable.carro);
//This function will change background drawable, so place it where you want.
// al.setBackgroundDrawable(drawable);
}
if (x<=20){
res = getResources();
drawable = res.getDrawable(R.drawable.info);
// al.setBackgroundDrawable(drawable);
}
if (x<=30){
res = getResources();
drawable = res.getDrawable(R.drawable.tel);
// al.setBackgroundDrawable(drawable);
x=0;
}
handler.sendEmptyMessage(0);
this.sleep(100);
} catch (InterruptedException ex) {
Logger.getLogger(Inicio.class.getName()).log(Level .SEVERE, null, ex);
}
}
}
};
private Handler handler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
al.setBackgroundDrawable(drawable);
}
};
no se si sea lo mejor , bueno que de todas formas me manda error
gohan0189
09/05/12, 21:55:24
alguien me puede decir cual es mi error xq me sale
Not able to submit breakpoint LineBreakpoint Inicio.java : 92, reason: No executable location available at line 92 in class SAO.AutoHelp.Inicio
gohan0189
09/05/12, 22:16:19
bueno mi dudA es el
handler.sendEmptyMessage(0);
sta bien ???
si mi handler es
private Handler handler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
al.setBackgroundDrawable(drawable);
}
};
gohan0189
09/05/12, 22:32:38
y si puedo hacer eso en mi handler????
gohan0189
10/05/12, 17:14:06
por favor ayudaaaa con esto no se que tenga mal??
vBulletin® v3.8.1, Copyright ©2000-2026, Jelsoft Enterprises Ltd.