Page 129 - MDP2022-2
P. 129
Handler handler = new Handler();
Handler handler2 = new Handler();
update.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
GetData task = new GetData();
task.execute(String.valueOf(temperature_want), "2",ID);
}
});
box.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Glide.with(box).load(R.raw.move).into(box);
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(getApplicationContext(), camera.class);
startActivity(intent);
}
}, 3500);
handler2.postDelayed(new Runnable() {
@Override
public void run() {
Glide.with(box).load(R.drawable.box_c).into(box);
}
}, 3800);
}
});
LED.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(led_cnt==0){
LED.setImageResource(R.drawable.lightbulb);
GetData task = new GetData();
task.execute(String.valueOf(temperature_want), "1",ID);
led_cnt=1;
}
else if(led_cnt==1){
LED.setImageResource(R.drawable.blackbulb);
GetData task = new GetData();
task.execute(String.valueOf(temperature_want), "0",ID);
led_cnt=0;
}