woong's

Android CheckBok 사용하기 본문

Develop/Android

Android CheckBok 사용하기

dlsdnd345 2016. 2. 14. 16:15
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Android CheckBok 사용하기


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
32
33
34
35
36
37
package com.example.h5bak_checkbox;
  
import android.app.Activity;
import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.Toast;
  
public class MainActivity extends Activity {
  
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        CheckBox checkbox = (CheckBox) findViewById(R.id.checkbox);
        checkbox.setOnCheckedChangeListener(mOnCheckedChangeListener);
    }
    
    OnCheckedChangeListener mOnCheckedChangeListener = new OnCheckedChangeListener(){
 
          @Override
          public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {
        if (buttonView.getId() == R.id.add_edit_check_date) {
                if (isChecked) {
                    checkDate = true;
                } else {
                    checkDate = false;
                }
               String resultDday = addEditService.getDday(todayString, checkDate);
               addEditDday.setText(resultDday);
            }
      }
      };
   
}
 


'Develop > Android' 카테고리의 다른 글

Android Widget ReSize 사용하기  (0) 2016.02.14
Android widget 사용하기  (0) 2016.02.14
Android TextView ... 처리  (0) 2016.02.14
안드로이드 레이아웃 최적화  (1) 2016.02.14
android back key & 뒤로가기 두번 종료  (0) 2016.02.14
Comments