디시인사이드 갤러리

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

갤러리 본문 영역

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

횽들봐줘(220.67) 2012.12.04 15:24:14
조회 191 추천 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 - -
339901 다들 특수기호 영어 발음 알고 있음? 스펠링은 몰라도 [5] 영꼰이갤로그로 이동합니다. 12.12.06 118 0
339900 NHN 신입 연봉 얼마야??? [5] ㄴㅇㄹ(121.168) 12.12.06 496 0
339899 HTML5의 위력 [4] ㅇㅇ(58.102) 12.12.06 185 0
339897 성추문 검사 여자사진이연! [3] 멘탈붕괴_갤로그로 이동합니다. 12.12.06 624 1
339896 이 책 입문서로 적당한거야? [6] 리플레이갤로그로 이동합니다. 12.12.06 154 0
339895 5개월만에 내가짠 프로그램 소스 보니 분석 해야하네 [4] 흐강갤로그로 이동합니다. 12.12.06 108 0
339894 TXT 에 저장해 놓은 일정한 양식의 SQL문을 DB로 불러올수있음? [7] 천국거지갤로그로 이동합니다. 12.12.06 78 0
339892 인간은 왜 회사에 다닐까? [6] e(175.192) 12.12.06 129 0
339891 뭐니뭐니해도 리버싱이 하는재미는 제일인것같다 [3] ㅁㅁ(211.244) 12.12.06 117 0
339890 프갤형님들, 내년 졸업인 내 스펙인데.. 좀봐주라 ㅠ_ㅠ [9] 뉴뉴비(121.143) 12.12.06 473 0
339889 c언어 잘하시분~! [4] c언어평민(61.214) 12.12.06 85 0
339888 아따 이거 두개 도대체 뭔차이다냐 ........ 내눈엔 그게 그건디 [6] 아따마(115.140) 12.12.06 85 0
339887 C++ 공부중이 뉴비가 질문드려요..ㅜㅜ [6] cpp뉴비(183.101) 12.12.06 105 0
339886 system.window.input.cursor 어떻게 참조추가하는가요 [2] 2222(183.109) 12.12.06 38 0
339885 형들 어제 프로그래밍 배운 늅늅인데 [3] ㅇㅅㅇ(182.215) 12.12.06 74 0
339884 파싱이 안되고 syntax error가 나는걸까.. [2] ㅋㄱ(183.96) 12.12.06 47 0
339883 ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ [4] 아따마(115.140) 12.12.06 66 0
339882 인터넷문제좀봐주세요 [3] ㅠㅠ(203.226) 12.12.06 30 0
339880 프로그래밍의 프짜도모르는 사람임니다.. [11] aa(1.239) 12.12.06 240 0
339879 잘자라 [2] 앱이다(211.234) 12.12.06 21 0
339878 레노미나가 내가 아는 레노미나가 맞냐? [4] 종자(118.36) 12.12.05 62 0
339877 컴공도 자동차회사 들어갈수잇어? [3] ㅇㅇ(121.140) 12.12.05 105 1
339876 루비온레일즈로 사이트 만들줄 아는사람? [4] 제에에발 (121.164) 12.12.05 107 0
339875 QT인지ㅄ인징..tablewidget에 %s형 데이터 어케 넣나여..ㅠㅠ 아오.QT인ㅄ(116.121) 12.12.05 363 0
339874 근데 님들 여기서 솔직히 [2] (&#039;&#039.(220.120) 12.12.05 97 0
339873 c언어 잘하는 사람 이것좀 부탁해요ㅜ [1] 살려줘 ㅜ(61.245) 12.12.05 89 0
339872 도와주세요 프갤러들아 [1] 태사웅(119.206) 12.12.05 30 0
339871 누구 오라클10좀 보내줘요 ㅠ.ㅠ 자바초보(112.187) 12.12.05 31 0
339870 갑자기 버그가 뿅하고 나타났는데 어떡하지 ? 하스갤로그로 이동합니다. 12.12.05 28 0
339868 열혈강의 vs c언어로 쉽게 풀어쓴 [3] (&#039;&#039.(220.120) 12.12.05 264 0
339867 앱게임같은거 혼자만들려면 얼마나배워야해? [2] 앱이다(211.234) 12.12.05 101 0
339866 후 .. 힘들다. [1] WannaParty갤로그로 이동합니다. 12.12.05 81 0
339864 포인터 하나 물어보쟝 [11] 안티푸라면갤로그로 이동합니다. 12.12.05 140 0
339863 캐드 문젠데 여기 물어봐도 돼요?ㅠㅠㅠ [3] 제발ㅠㅠㅠㅠ(112.149) 12.12.05 77 0
339862 저번에 내가 게임 충돌체크 물어봤을 때 자기가 7년 게임 개발했는데 [5] 영꼰이갤로그로 이동합니다. 12.12.05 199 0
339861 c언어로 충돌하는 게임 만드려는데ㅠㅠ [6] 死라인(119.18) 12.12.05 164 0
339860 저 사실 재수생 이에요.. 후.. 속상해서 술마심 Kyle(220.244) 12.12.05 108 0
339859 그리고 내가 지금 강사 어이없는게; [2] ....(182.218) 12.12.05 56 0
339858 it학원들은 다 사기인것처럼 보여. [1] ....(182.218) 12.12.05 453 0
339856 아무대나 static 붙이니까 병신되네 하스갤로그로 이동합니다. 12.12.05 78 0
339855 이번에 성과급 나온다는데 설랜다 ㅇㅇ(58.102) 12.12.05 43 0
339854 PHP 입문서 추천 받습니다 [2] 리플레이갤로그로 이동합니다. 12.12.05 83 0
339853 혹시 x-code해주실분 않계신가요... [7] ㅇㅇ(125.139) 12.12.05 129 0
339851 몰래결제.txt ㅂㄷㅈ(1.220) 12.12.05 73 0
339850 안드로이드 프로그래밍을 하다보면 [4] ㅋㅅㄹ(110.15) 12.12.05 155 0
339849 소멤 서류는 붙을 수 있을까?? 음메(1.218) 12.12.05 140 0
339848 역시 안드로이드는 커스터마이징 하는 맛으로 한다니껜 하스갤로그로 이동합니다. 12.12.05 53 0
339847 바빠죽겠는데넘우울해... [2] 모모(211.234) 12.12.05 56 0
339846 c++ 간단한거 질문점 ㅠ.ㅠ [13] 잉여잉여(14.33) 12.12.05 149 0
339845 php date() [4] ㅋㅌㅊ(1.220) 12.12.05 59 0
뉴스 보이그룹 에픽트레버스, 오늘(14일) 드라마 ‘풋풋한 로맨스’ OST ‘I fall in love’ 발매!  디시트렌드 07.14
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2