Search Results for 'runnable'


1 POSTS

  1. 2010/01/29 Android Runnable by Tcher

Android Runnable

Runnable 은 Thread 를 서브클래스하지 않고 클래스를 액티브하게 하는 수단을
제공한다.

Thread 클래스 메소드 중 run() 만을 사용할 때는
Thread 를 서브 클래스로 구현할 필요 없이 Runnable 만을 가지고
구현하는게 좋다.

복잡한 Thread 구현을 하고자 한다면 Thread 를 확장해서 사용하면 된다.

======================================================
package com.inculab;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;

public class RunnableTest extends Activity {

 private Handler mHandler = null;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  // TODO Auto-generated method stub
  super.onCreate(savedInstanceState);
 
  mHandler = new Handler();
  Runnable r = new Runnable() {
   
   public void run() {
    // TODO Auto-generated method stub
    Log.d("Test", "hello");
    mHandler.postDelayed(this, 1000);
   }
  };  
  mHandler.postDelayed(r, 1000);
 }
}
======================================================

Posted by Tcher

2010/01/29 10:33 2010/01/29 10:33
, ,
Response
No Trackback , No Comment
RSS :
http://blog.inculab.net/rss/response/25

Trackback URL : http://blog.inculab.net/trackback/25

Leave a comment
[로그인][오픈아이디란?]

블로그 이미지

- Tcher

Notices

Site Stats

Total hits:
24429
Today:
59
Yesterday:
117