우선
회사 정책상 파일 업로드가 불가하여 코드하이라이터 사용못한점 양해 바랍니다.
아래보시면 startTimer 메소드가 있는데요. 이메소드는 onCreate 시 호출되는 부분입니다.
소스중에 빨간색 부분으로 진입시 에러가 납니다 에러코드는 아래와 소스 밑에 있습니다.
로직은 이렇습니다. onCreate()가되고 startTimer()가 실행되고 카운트가 마이너스가 되면서
63, 62, 61, 60 59일때 이미지가 변경됩니다.
그리고 마지막에 0이되면 "게임오버"라는 이미지가 나타는것 인데요.
대충 이미지 리사이즈 하면서 에러나는것 같은데요 수정이 쉽지않네요 도와주세요~
public void startTimer(){
GugudanMain.PLAY_TIME = 64;
new CountDownTimer(70 * 1000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
GugudanMain.PLAY_TIME--;
countDownArea = (ImageView)findViewById(R.id.countDown);
if(GugudanMain.PLAY_TIME == 63){
Bitmap orgImage = BitmapFactory.decodeResource(getResources(), countDown3Id);
Bitmap resize = Bitmap.createScaledBitmap(orgImage, 100, 100, true);
countDownArea.setImageBitmap(resize);
}else if(GugudanMain.PLAY_TIME == 62){
Bitmap orgImage = BitmapFactory.decodeResource(getResources(), countDown2Id);
Bitmap resize = Bitmap.createScaledBitmap(orgImage, 100, 100, true);
countDownArea.setImageBitmap(resize);
}else if(GugudanMain.PLAY_TIME == 61){
Bitmap orgImage = BitmapFactory.decodeResource(getResources(), countDown1Id);
Bitmap resize = Bitmap.createScaledBitmap(orgImage, 100, 100, true);
countDownArea.setImageBitmap(resize);
}else if(GugudanMain.PLAY_TIME == 60){
Bitmap orgImage = BitmapFactory.decodeResource(getResources(), countDown0Id);
Bitmap resize = Bitmap.createScaledBitmap(orgImage, 100, 100, true);
countDownArea.setImageBitmap(resize);
}else if(GugudanMain.PLAY_TIME == 59){
Bitmap orgImage = BitmapFactory.decodeResource(getResources(), countDownNullId);
Bitmap resize = Bitmap.createScaledBitmap(orgImage, 100, 100, true);
countDownArea.setImageBitmap(resize);
}else if(GugudanMain.PLAY_TIME == 0){
Bitmap orgImage = BitmapFactory.decodeResource(getResources(), countDownOver);
Bitmap resize = Bitmap.createScaledBitmap(orgImage, 100, 100, true);
countDownArea.setImageBitmap(resize);
onFinish();
}
if(GugudanMain.PLAY_TIME <= 60){
Log.d("", "time : "+GugudanMain.PLAY_TIME);
Bitmap orgImage1 = BitmapFactory.decodeResource(getResources(), R.drawable.time_bar);
Bitmap resize1 = Bitmap.createScaledBitmap(orgImage1, GugudanMain.PLAY_TIME * 4, 15, true);
time_bar.setImageBitmap(resize1);
}
}
@Override
public void onFinish() {
}
}.start();
}
에러내용 입니다.
FATAL EXCEPTION: main
java.lang.IllegalArgumentException: width and height must be > 0
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
at co.kr.GugudanPlay$1.onTick(GugudanPlay.java:224)
at android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:124)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Force finishing activity co.kr/.GugudanPlay
Activity pause timeout for HistoryRecord{43fcefc8 co.kr/.GugudanPlay}
Launch timeout has expired, giving up wake lock!
Activity idle timeout for HistoryRecord{43fe3d78 co.kr/.GugudanMain}
Activity destroy timeout for HistoryRecord{43fcefc8 co.kr/.GugudanPlay}