aruna sameera wrote:this is my main xml file.when i run my project it gives the expected out put.I have attached the screenshot too.But if i change the android:orientation to horizontal it shows blank screen.I have attached that screenshot too.Please advice.
Nidhi Sar wrote:
D Hagy wrote:I tried to make it with thread, but with the thread I can't change it. Now I tried to make a handler but it's not good either.
Here is the original thread code:
I hope you can understand what I want to do, sorry I'm not perfect english If you can, please give me an alternative code for this. It's very annoying, that only this is what I need for my program, but I can't do this. Sorry if this question, is so easy or something but I'm a beginner programmer.
I didn't actually try it, but when you say " but with the thread I can't change it", I'm assuming that you are getting a CalledFromWrongTreadException (you can see the exception in the LogCat).
The line radar.setImageResource(R.drawable.radar_full); and other two need to run on the UI thread, so replace this single line with the following block - the other two would need to be changed too :
Hardik Trivedi wrote:You can try this.
Thread t=new Thread(new Runnable() {
public void run()
{
try
{
Thread.sleep(2000);// After 2 seconds
//Change Image
Thread.sleep(5000);// After 5 seconds
//Change Image
Thread.sleep(7000);// After 7 seconds
//Change Image
}
catch(Exception e)
{
}
}
});
t.start();
Hardik Trivedi wrote:You can try this.
Thread t=new Thread(new Runnable() {
public void run()
{
try
{
Thread.sleep(2000);// After 2 seconds
//Change Image
Thread.sleep(5000);// After 5 seconds
//Change Image
Thread.sleep(7000);// After 7 seconds
//Change Image
}
catch(Exception e)
{
}
}
});
t.start();