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 , 4 Comments
RSS :
http://blog.inculab.net/rss/response/25

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

Comments List

  1. 코드는 2011/04/20 22:33 # M/D Reply Permalink

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

  2. SixthSense 2011/05/27 17:14 # M/D Reply Permalink

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

  3. cheap ray ban 2011/10/21 11:11 # M/D Reply Permalink

    find cheap <a href="http://www.echeapraybansunglasses.com/"><strong>ray ban aviator</strong></a> products on the <a href="http://www.echeapraybansunglasses.com/"><strong>ray ban sunglasses</strong></a> store, then you can see the fashion <a href="http://www.echeapraybansunglasses.com/"><strong>aviator sunglasses</strong></a>, enjor to buy <a href="http://www.echeapraybansunglasses.com/"><strong>raybands</strong></a> gooo.

  4. www.christianloubout 2011/12/12 21:53 # M/D Reply Permalink

    clx
    http://www.christianlouboutinsalessneakers.com/christian-louboutin-2011-c-36.html
    http://www.christianlouboutinsalessneakers.com/christian-louboutin-2011-c-36.html
    http://www.christianlouboutinsalessneakers.com/christian-louboutin-pumps-c-26.html
    http://www.christianlouboutinsalessneakers.com/christian-louboutin-sandals-c-31.html
    http://www.christianlouboutinsalessneakers.com/christian-louboutin-wedges-c-29.html
    http://www.christianlouboutinsalessneakers.com/christian-louboutin-slingback-c-30.html

Leave a comment
[로그인][오픈아이디란?]
« Previous : 1 : ... 23 : 24 : 25 : 26 : 27 : 28 : 29 : 30 : 31 : ... 47 : Next »

블로그 이미지

- Tcher

Notices

Site Stats

Total hits:
84625
Today:
61
Yesterday:
91