package exam.AndroidFirst;
import android.app.*;
import android.content.*;
import android.graphics.*;
import android.graphics.drawable.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.util.Log;
public class AndroidFirst extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MyView vw = new MyView(this);
setContentView(vw);
}
class MyView extends View {
int width, height;
int rw, rh;
Bitmap charactor;
int x;
int y;
String TAG;
Handler mHandler = new Handler() {
public void handleMassage(Message msg){
invalidate();
mHandler.sendEmptyMessageDelayed(0,10); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<여기서 beakpoint걸음
}
};
public MyView(Context context) {
super(context);
x=10;
y=10;
charactor = BitmapFactory.decodeResource(context.getResources(),R.drawable.mob_right1);
rw= charactor.getWidth();
rh= charactor.getHeight();
mHandler.sendEmptyMessageDelayed(0,10);
}
public void onDraw(Canvas canvas) {
x += 1;
Log.d(TAG, \"123123123123 \" + x);
canvas.drawBitmap(charactor, x, 100, null);
}
}
}
ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ오늘 안드로이드 시작하는 늅인데
이거 간단히 그림이 x좌표가 증가하면서 핸들써서 오른쪽으로 가게 보이는 소스인대
책에 따라 같이 햇단 말야? 근데 핸들러 작동을 안하는것 ㄱㅌ음 ㅠㅠㅠㅠ
mHandler.sendEmptyMessageDelayed(0,10); 여기에 beakpoint 걸고 다음 실행 햇는데 짤방화면 떳음 ㅠㅠㅠ 이거 파일 문제인가요??
다른 핸들 예제는 돌아가던대 ㅠㅠㅠ
댓글 0