[Q]How to change imageview to another with an interval

Search This thread

dev_freak

Senior Member
Oct 11, 2014
208
31
24
Ermelo
www.youtube.com
Hello,

I got a question. I'm trying to develop an app with some traffic light, it is made out of open source images. It is from a learn to develop android apps couse from udemy. I wanted to add something, I thought about a button with an automatic change function and stop function, with an interval to change the lights on and off. Do you guys have any idea how to do that?

Thanks in advance,
dev_freak
 

eng.ahmed.android

Senior Member
Dec 11, 2013
67
23
Hello,

I got a question. I'm trying to develop an app with some traffic light, it is made out of open source images. It is from a learn to develop android apps couse from udemy. I wanted to add something, I thought about a button with an automatic change function and stop function, with an interval to change the lights on and off. Do you guys have any idea how to do that?

Thanks in advance,
dev_freak

I think you can use this :

Code:
new Handler().postDelayed(new Runnable() {
			@Override
			public void run() {
				/* Put below your new function. */
				Intent intent = new Intent(SplashActivity.this, MainActivity.class);
				startActivity(intent);
				finish();
			}
		}, 5000);

Second parameter is the interval in seconds. (eg: 5 seconds = 5000)
 
  • Like
Reactions: Traabefi

dev_freak

Senior Member
Oct 11, 2014
208
31
24
Ermelo
www.youtube.com
I think you can use this :

Code:
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
/* Put below your new function. */
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
}, 5000);

Second parameter is the interval in seconds. (eg: 5 seconds = 5000)
A bit late, but it didn't work
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hello,

    I got a question. I'm trying to develop an app with some traffic light, it is made out of open source images. It is from a learn to develop android apps couse from udemy. I wanted to add something, I thought about a button with an automatic change function and stop function, with an interval to change the lights on and off. Do you guys have any idea how to do that?

    Thanks in advance,
    dev_freak

    I think you can use this :

    Code:
    new Handler().postDelayed(new Runnable() {
    			@Override
    			public void run() {
    				/* Put below your new function. */
    				Intent intent = new Intent(SplashActivity.this, MainActivity.class);
    				startActivity(intent);
    				finish();
    			}
    		}, 5000);

    Second parameter is the interval in seconds. (eg: 5 seconds = 5000)