이 블로그 검색

2011년 3월 17일 목요일

Intro 화면 만들기

 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  
  MyView vw = new MyView(this);    // <- OnCreate() 에 요렇게 View 객체 생성 
  setContentView(vw);                   // <- SetContentView 에 요렇개 삽입
 
  /* 요부분에 시간이 많이 소요되는 작업을 해준다 */
  init();
  setStationList(Define.SUBWAY_LOCAL_SEOUL);

 /* 시간이 많이 소요되는 작업들 */

    handler = new Handler();                   // <-  요런식으로 Handler 를 생성해주고       
     if(flag == true){
         handler.postDelayed(new Runnable() {
             public void run() {
              bitmap.recycle();
              intent = new Intent(Act_Intro.this, Act_Main.class);
               // <- Intent로 실제 Main 객체로 이동.        
              startActivity(intent);
              finish();
              overridePendingTransition(0, 0);
             }
            }, 3000);    
        }
}

 protected class MyView extends View {        // <- 요런식으로 View 클래쓰를 만들고...
  public MyView(Context context) {
   super(context);
   bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.intro);  // Bitmap 객체  }
   public void onDraw(Canvas canvas){                     // OnDraw() 함수...  
   canvas.drawBitmap(bitmap, null, new Rect(0,0,this.getWidth(),this.getHeight()), pnt);  
          }   // <- 캔바스에 bitmap 객체 넣으면, 그 비트맵이 그려짐.
 }

댓글 없음:

댓글 쓰기