'finish()'에 해당되는 글 1건

  1. 2011.05.24 [안드로이드] 인트로 화면 구성하기
  
public class Intro extends Activity {
    Handler myHandler = new Handler();
    Runnable myRunnable = new Runnable() {

    public void run() {
        Intent i = new Intent(Intro.this, Host.class);
        overridePendingTransition(R.anim.fade, R.anim.hold);
        i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        Intro.this.startActivity(i);
        finish(); - 백했을경우 닫아 버리기
        // overridePendingTransition(0,0);
        // startActivity(new Intent(IntroActivity.this, netturn.class));
        }
    };

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.intro);

       
   
        myHandler.postDelayed(myRunnable, 3000); // 딜레이 지정

    }

    public boolean onKeyDown(int keyCode, KeyEvent e) {
    Log.v(null, "" + keyCode);
            if (keyCode == KeyEvent.KEYCODE_BACK) {
            }
        return false;
    }
    public boolean onKeyDown1(int keyCode, KeyEvent e) {
    Log.v(null, "" + keyCode);
        if (keyCode == KeyEvent.KEYCODE_HOME) {
        myHandler.removeCallbacks(myRunnable);
        }
    return false;
    }
}
Posted by 예배하는 프로그래머