일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- #android activity
- 하이퍼레저패브릭
- #1차원배열
- #JAVASCRIPT
- border-box
- html charset
- html code
- relative path
- #다차원포인터
- #CallByAddress
- html object
- #bubbleSort
- html plug-in
- html multimedia
- #3차원배열
- #2차원배열
- html5 new tag
- #binary
- hyperledger transaction
- docker example
- #자바상속#자바이즈어#is~a
- 토큰경제
- html youtube
- html video
- html id
- #C++ has~a
- #성적관리프로그램
- mac terminal command
- git flow
- #C++ 연산자함수오버로딩
Archives
- Today
- Total
A sentimental robot
Handler 본문
package com.example.i310_54.myapplication08;
import android.graphics.Color;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
String TAG="EUNBI";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
Handler handler=new Handler(){
@Override
public void handleMessage(Message msg) {
switch (msg.what){
case 100:
Log.d(TAG, "handleMessage: 100");
handler.sendEmptyMessageDelayed(100,500);
break;
case 200:
Log.d(TAG, "handleMessage: 200");
handler.sendEmptyMessageDelayed(200,700);
break;
}
}
};
public void f1(View view) {
handler.sendEmptyMessage(100);
}
public void f2(View view) {
handler.sendEmptyMessage(200);
}
public void f3(View view) {
handler.removeMessages(100);
}
public void f4(View view) {
handler.removeMessages(200);
}
}
'Android Studio' 카테고리의 다른 글
OnTouch (0) | 2018.02.06 |
---|---|
RelativeLayout (0) | 2018.02.06 |
GridLayout2 (0) | 2018.02.05 |
GridLayout (0) | 2018.02.05 |
배경색 자동으로 바꾸기 (0) | 2018.02.01 |