CardGameActivity.java

 

package org.game;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class CardGameActivity extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_card_game);
 }

 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu; this adds items to the action bar if it is present.
  getMenuInflater().inflate(R.menu.activity_card_game, menu);
  return true;
 }

}

 

 

CardGameView.java

 

 

package org.game;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.view.View;

public class CardGameView extends View{
 
 Bitmap m_BackGroundImage;
 public CardGameView(Context context){
 super(context);
 m_BackGroundImage = BitmapFactory.decodeResource(getResources(),
   R.drawable.background,null);
 }
 @Override
 public void onDraw(Canvas canvas){
  canvas.drawBitmap(m_BackGroundImage, 0, 0,null);
 }
}

 

 

 

불러올 이미지는 첨부해두었습니다..

png 파일이고.. 책에 나와있는데로 하고 실행했는데도

 

 

사진이 안뜨고 헬로월드 인가 그거만 뜨네요..

 

 

안드로이드  에뮬레이터 실행은

이클립스 주노

 

Devide 5.1 WVGA (480X800 mdpi)

Target android 4.1.2 api 16

cpu arm

 

뭐가 문제인가여...