2007 2013 Kandroid
www.kandroid.org »
kandroid s/w fundamentals 교육 »
Listening for UI Notifications
작성자 들풀
작성일 2008-03-03 (월) 11:01
ㆍ추천: 0  ㆍ조회: 1254      
IP: 221.xxx.120

Listening for UI Notifications
[알림 사용자 인터페이스를 위한 대기]

Some UI notifications are automatically exposed and called by Android. For instance, Activity exposes
overrideable methods onKeyDown and onKeyUp, and Widget exposes onFocusChanged(boolean, int).
However, some important callbacks, such as button clicks, are not exposed natively, and must be
registered for manually, as shown here.
 
몇몇의 알림 사용자 인터페이스는 자동으로 나타나며 안드로이드에 의해 호출된다. 예를 들자면, Activity는
오버라이드 가능한 메쏘드 onKeyDown과 onKeyUp 를, Widget은 onFocusChanged(boolena, int) 를
호출한다. 그렇지만, 몇몇 중요한 콜백들, 버튼 클릭과 같은 것은 기본적으로 호출되지 않는다. 그리고
여기서 보여진 것 처럼 직접 등록해야 한다.
 
public class SendResult extends Activity
{
    /**
     * Initialization of the Screen after it is first created.  Must at least
     * call setContentView() to
     * describe what is to be displayed in the screen.
     */
    protected void onCreate(Bundle savedValues)
    {
        ...
        // Listen for button clicks.
        Button button = (Button)findViewById(R.id.corky);
        button.setOnClickListener(mCorkyListener);
    }
    // Create an anonymous class to act as a button click listener.
    private OnClickListener mCorkyListener = new OnClickListener()
    {
        public void onClick(View v)
        {
            // To send a result, simply call setResult() before your
            // activity is finished.
            setResult(RESULT_OK, "Corky!");
            finish();
        }
    };
덧글 쓰기 0
3500
※ 회원등급 레벨 0 이상 읽기가 가능한 게시판입니다.
    N     분류     제목    글쓴이 작성일 조회
46 Implementing a User Interface [1] 들풀 2008-03-03 2352
45 Hierarchy of Screen Elements 들풀 2008-03-03 2038
44 Common Layout Objects [1] 들풀 2008-03-03 2524
43 Working with AdapterViews 들풀 2008-03-03 1302
42 Designing Your Screen in XML 들풀 2008-03-03 1542
41 Listening for UI Notifications 들풀 2008-03-03 1254
40 Applying a Theme to your Application 들풀 2008-03-03 1282
39 UI Elements and Concepts Glossary 들풀 2008-03-03 1695
38 Android Building Blocks 들풀 2008-03-03 1681
37 Storing, Retrieving and Exposing Data 들풀 2008-03-03 1064
36 Security and Permissions in Android 들풀 2008-03-03 1303
35 Life Cycle of an Android Application 들풀 2008-03-03 2513
34 Developing Android Applications 들풀 2008-03-03 1557
33 Resources and Internationalization 들풀 2008-03-03 1178
32 Android Developer Toolbox 들풀 2008-03-03 1937
31 Android Application Design Philosophy 들풀 2008-03-03 1450
12345