디시인사이드 갤러리

갤러리 이슈박스, 최근방문 갤러리

갤러리 본문 영역

자바 안드로이드로 두더지게임 만들고있는데 막혔어.. 문제점좀 봐줘

횽들봐줘(220.67) 2012.12.04 15:24:14
조회 190 추천 0 댓글 5

졸업작품으로 두더지게임을 만들어야되는데, 지금 막히는 부분이 있어.
원래 두더지 구멍그림이 9개 있는데, 난수를 1~9까지 줘서 1초마다 난수를 발생시켜. 그다음에
난수가 1이 발생되면 첫번째 구멍그림에서 두더지가 나오게끔.. 이렇게 하려고하는데
두더지 그림이 안나타나고 구멍이 사라지네. 그리고 다시 1초후에는 두더지가 들어가고 다시 구멍그림이 나와야되는데
안나타나고 그대로야.. 문제점좀 봐줘 ㅠㅠ 부탁이야
아 그리고 구멍이미지는 레이아웃으로 꾸몄어..

이건 코드야
package com.example.timer;

import java.util.Random;

import android.app.Activity;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ImageView;
import android.widget.TextView;

public class Timer extends Activity {
 int value=0, ran=0;
 TextView mText;
    Handler mHandler;
    Random m_ran = new Random();
    ImageView img01, img02, img03, img04, img05, img06, img07, img08, img09;
    int[] ImageArray = new int[] {R.drawable.mols02};
 @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        mText = (TextView) findViewById(R.id.time);
        img01 = (ImageView) findViewById(R.id.imageView1);
        img02 = (ImageView) findViewById(R.id.imageView2);
        img03 = (ImageView) findViewById(R.id.imageView3);
        img04 = (ImageView) findViewById(R.id.imageView4);
        img05 = (ImageView) findViewById(R.id.imageView5);
        img06 = (ImageView) findViewById(R.id.imageView6);
        img07 = (ImageView) findViewById(R.id.imageView7);
        img08 = (ImageView) findViewById(R.id.imageView8);
        img09 = (ImageView) findViewById(R.id.imageView9);
       
        mHandler = new Handler() {
         public void handleMessage(Message msg) {
          ran = m_ran.nextInt(9) + 1;
          value++; //시간(초) 증가
          mText.setText("TIME = " + value); //시간(초) 화면에표시
          switch (ran) {
          case 1:
           img01.setImageResource(ImageArray[0]);
           break;
          case 2:
           img02.setImageResource(ImageArray[0]);
           break;
          case 3:
           img03.setImageResource(ImageArray[0]);
           break;
          case 4:
           img04.setImageResource(ImageArray[0]);
           break;
          case 5:
           img05.setImageResource(ImageArray[0]);
           break;
          case 6:
           img06.setImageResource(ImageArray[0]);
           break;
          case 7:
           img07.setImageResource(ImageArray[0]);
           break;
          case 8:
           img08.setImageResource(ImageArray[0]);
           break;
          case 9:
           img09.setImageResource(ImageArray[0]);
           break;
          }
          if( value < 60 ) { //60초가 지나면 종료
           mHandler.sendEmptyMessageDelayed(0, 1000);
          }
         }
        };
        mHandler.sendEmptyMessage(0);
 }
}

이건 레이아웃이야
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/jandi" />
   
    <TextView
        android:id="@+id/score"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="12pt" />

    <TextView
        android:id="@+id/time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right|top"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="30dip"
        android:textSize="12pt" />
   
    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/time"
        android:layout_gravity="center" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginBottom="5dip" >

            <ImageView
                android:id="@+id/imageView1"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:src="@drawable/hole" />

            <ImageView
                android:id="@+id/imageView2"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:src="@drawable/hole" />

            <ImageView
                android:id="@+id/imageView3"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:src="@drawable/hole" />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dip" >

            <ImageView
                android:id="@+id/imageView4"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/hole" />

            <ImageView
                android:id="@+id/imageView6"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/hole" />

            <ImageView
                android:id="@+id/imageView7"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/hole" />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dip" >

            <ImageView
                android:id="@+id/imageView5"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/hole" />

            <ImageView
                android:id="@+id/imageView8"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/hole" />

            <ImageView
                android:id="@+id/imageView9"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/hole" />

        </TableRow>
    </TableLayout>
   
</FrameLayout>

추천 비추천

0

고정닉 0

0

댓글 영역

전체 댓글 0
본문 보기

하단 갤러리 리스트 영역

왼쪽 컨텐츠 영역

갤러리 리스트 영역

갤러리 리스트
번호 제목 글쓴이 작성일 조회 추천
설문 이번주 설문은 탈모 걱정 없어 보이는 머리숱 금수저 스타는? 운영자 25/07/14 - -
AD 디지털 액세서리 기간한정 세일! 운영자 25/07/11 - -
339751 근데 왜 프갤에서 프로그래밍 질문하냐 하스갤로그로 이동합니다. 12.12.04 42 0
339750 프로그램수정을 [10] ㅂㅈㄷ(1.220) 12.12.04 182 0
339749 형들 오늘 고딩한테 담배를 사줬어 [2] 꿈꾸는낭만갤로그로 이동합니다. 12.12.04 115 0
339747 안드로이드 Fragment 잘하는 형 없음? [1] dd(210.94) 12.12.04 50 0
339746 여기잇는사람들 답없다 [2] 겟앰푸딩(220.120) 12.12.04 90 0
339745 전처리기는 디버깅 안되냐 [2] (203.237) 12.12.04 60 0
339744 운전면허필기 만점받음 ㅋㅋ ㅗㅗ (121.174) 12.12.04 54 0
339743 자바 안드로이드 두더지게임 만들어야되는데 네이트로 도와주실분... [2] 예비군아저씨갤로그로 이동합니다. 12.12.04 117 0
339742 파스칼 소스는 구했는데 할매문자근성(119.208) 12.12.04 56 0
339741 자료구조는 근데 [1] 겟앰푸딩(220.120) 12.12.04 82 0
339740 백왕 어드밴쳐 2탄 - 곽노현 .txt Kyle(220.244) 12.12.04 52 0
339739 님들 꼭와주셈 자료구조 공부법 [3] 자료구조(220.120) 12.12.04 432 0
339738 백왕 어드밴쳐 1탄.txt Kyle(220.244) 12.12.04 41 0
339736 이야 쩐다 ㅇㅇ가 보면 분노할 동영상이 떴네 [1] JSP(182.211) 12.12.04 79 0
339735 C프로그래밍 질문있다 도와주라 [7] 씨벌(166.104) 12.12.04 126 0
339734 프로그래머 하려는 새끼가 잴불쌍.. 차라리 일용직 잡부가... [2] 미쿸사람(125.185) 12.12.04 198 0
339732 비전공자가 학원다니면 it일자리 못구함? [2] ㅇㅇ(61.77) 12.12.04 252 0
339730 후....... 이력서 쓰는것도 지겹다. [1] JSP(182.211) 12.12.04 87 0
339729 자바뉴비가 질문좀 할께요 너무 급해서 ㅠ 자바뉴비ㅠㅠ(119.208) 12.12.04 54 0
339727 프로그래머들도 운동좀 해야하지않나 [4] ㅇㅇ(61.77) 12.12.04 143 0
339726 호성이 잡기 하스갤로그로 이동합니다. 12.12.04 44 0
339724 방금 조낸 무서운 일이 일어났었어 ㄷㄷㄷ [5] ㄷㄷㄷ(182.211) 12.12.04 143 0
339722 c#은 다들 일거리가 없나? ㅇㅇ(220.103) 12.12.04 60 0
339721 요즘 생각해보니까 [1] ??(14.63) 12.12.04 40 0
339720 컴맹인데 실셍활에 유용한 지식좀 쌓을려는데.. [10] 컴맹(116.34) 12.12.04 126 0
339719 다우기술 어떄? 으하히하훃(112.169) 12.12.04 38 0
339718 형들, 엔진은 어떻게 구해 ? [5] 하스갤로그로 이동합니다. 12.12.04 95 0
339717 야 서버os 윈도우가 낳냐 리눅스가 낳냐 [10] ㅁㄴㅇㄹ(211.213) 12.12.04 193 0
339716 친구가 구로 쪽은 죄다 쓰레기 라는데 이건 일반화 오류겠지?? [5] JSP(182.211) 12.12.04 111 0
339715 어휴...... 경력이 개판이니 연락도 없네...... [1] JSP(182.211) 12.12.04 82 0
339714 솔데스크에 낚인듯...ㅠㅠㅠ [5] ㄷㄷ(211.234) 12.12.04 317 0
자바 안드로이드로 두더지게임 만들고있는데 막혔어.. 문제점좀 봐줘 [5] 횽들봐줘(220.67) 12.12.04 190 0
339711 망했어. 다 끝났다구... [1] 영꼰이갤로그로 이동합니다. 12.12.04 61 0
339710 평생직장불가능함?? [6] ㅁㅁ(211.234) 12.12.04 138 0
339708 이런 여자랑 크리스마스에 스키장 가서 뒹굴고 싶다. [3] JSP(182.211) 12.12.04 301 1
339707 재미가 없다.. [2] ☎2.52™갤로그로 이동합니다. 12.12.04 64 0
339706 프로그래머의 삶이 궁금하다고? ㅁㄴㅇㄹ(211.213) 12.12.04 98 0
339705 프로그래머는 왜이리 수명이 짧은건가..... 후.... [4] JSP(182.211) 12.12.04 214 1
339704 프로그래머는 나이 어느정도 먹으면 취업하기 힘들어?? [3] JSP(182.211) 12.12.04 254 0
339703 HTML css책 사는데 이책어떰? [1] as2211(180.80) 12.12.04 114 0
339702 ★☆ 아이폰앱 개발 의뢰좀 부탁 ★☆ [1] ㅇㅇㅇ(1.235) 12.12.04 56 0
339701 c언어첨인데 while문 for문 왤캐어려움?? [9] ㅁㄴㅇㄻㄴ(180.80) 12.12.04 137 0
339700 함수명 추천좀 [7] 조현석(210.220) 12.12.04 80 1
339699 프로그래머의삶은어떠합니까 [1] 빼빼로(211.234) 12.12.04 59 0
339698 혹시 우면동 kt 연구개발본부에서 파견이나 서식 중인 폐인들 있나? [4] 엽기토깽이갤로그로 이동합니다. 12.12.04 164 0
339696 형들 도와줘...c#에서 웹사이트 로그인 하는 법좀 제로데빌갤로그로 이동합니다. 12.12.04 49 0
339695 데이터베이스 검색엔진... 초보좀도와줘(108.28) 12.12.04 60 0
339692 알고리즘 수업 때 들은 이야기가 생각난다 [1] dot(59.5) 12.12.04 106 0
339691 퀵정렬로 정렬이 안됨.........제발 알고리즘 굇수님들 [4] 운지(117.111) 12.12.04 129 0
339690 형들 나 DevC++로 프로그래밍 입문하는데 좀 도와줘 ㅠㅠ [19] (203.236) 12.12.04 147 0
뉴스 권은비, “꽃 사주는 男”...이상형 밝혀 디시트렌드 07.13
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2