디시인사이드 갤러리

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

갤러리 본문 영역

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

횽들봐줘(220.67) 2012.12.04 15:24:14
조회 192 추천 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 - -
338015 얘 근육 존나섹시하지않냐 [2] ㅁㅁ(211.244) 12.11.20 92 0
338014 너네 초봉 2550 넘은 애들 있음? 대기업 말고 [11] 영꼰이갤로그로 이동합니다. 12.11.20 231 0
338013 39 C1 A4 C2 58 D5 E0 AC F6 C2 E4 B2 [8] ㅁㅁ(211.244) 12.11.20 101 0
338012 진심으로 연봉 때문에 걱정이다. [1] 영꼰이갤로그로 이동합니다. 12.11.20 138 0
338011 역시 돈 버는데는 임대업, 대부업이 최고인거 같다 [9] 워킹푸어(182.211) 12.11.20 120 0
338009 그래서 난 2잡을 하려고 합니당~ [3] 워킹푸어(182.211) 12.11.20 58 0
338008 롤 게임가드가 없길레 무슨깡인가해서 분석해봤는데 [9] ㅁㅁ(211.244) 12.11.20 508 0
338007 한국에 사는거 자체가 고통이다. [4] 워킹푸어(182.211) 12.11.20 99 0
338006 횽들 프로그래밍의 프짜도 모르는데 말이야 [5] 상상(211.246) 12.11.20 86 0
338005 프갤엔 맨날똑같은놈만 들어오는구나 얼룩돼지갤로그로 이동합니다. 12.11.20 34 0
338003 근데 뉴스 같은거 보면 조낸 빡치지 않냐?? [1] 워킹푸어(182.211) 12.11.20 34 0
338001 일을 하고 열심히 사는데도 언제나 돈이 없는 사람 [10] 워킹푸어(182.211) 12.11.20 79 0
338000 형들 .. 이 프로그램 알고리즘 어떻게 짜야할까? [10] WannaParty갤로그로 이동합니다. 12.11.20 104 0
337998 노트북 사고싶다 [3] 사랑돋긔갤로그로 이동합니다. 12.11.20 186 0
337997 너네 대기업 말고 SI업체 가면 대졸초임 얼마가 현실적이라고 생각하니 [6] 영꼰이갤로그로 이동합니다. 12.11.20 183 0
337996 시팍 쓸만한 회사가 x도 없어!! [2] 구직중(182.211) 12.11.20 70 0
337995 c++에서 클래스만들떄 질문좀 [1] 김학점갤로그로 이동합니다. 12.11.20 46 0
337994 졸춥다 [1] 정수정•‿•갤로그로 이동합니다. 12.11.20 39 0
337993 ㅔ호ㅓ호ㅓ [2] 사랑돋긔갤로그로 이동합니다. 12.11.20 262 0
337992 이제 돌아왔네 이모군(175.114) 12.11.20 24 0
337991 밑에 징기스칸4 같이 게임 제한 걸린거 풀어달라는거 [4] 69(202.30) 12.11.20 55 0
337990 안드로이드 구글플레이 스토어에 앱 올려보신분 봐주세요 [3] 오호(175.192) 12.11.20 64 0
337989 아오 시팍 요즘은 x만한 회사도 요구사항이 드럽게 많네여 [2] 구직중(182.211) 12.11.20 105 0
337987 밥들먹고 일하라는 [1] 얼룩돼지갤로그로 이동합니다. 12.11.20 47 0
337985 나는 컴퓨터로 자동차와 IT의 결합 및 맵핵? 이딴거 [6] 69(202.30) 12.11.20 90 0
337984 프갤은 디시갤중에 제일현실적인 갤러리인것같다 [2] aa(211.244) 12.11.20 93 0
337982 오 블박 사업 쪽도 괜찮을 거 같다. [9] 영꼰이갤로그로 이동합니다. 12.11.20 78 0
337981 여기 사람들은 '컴퓨터'란 도구로 뭘 하고 싶은거야? [5] 69(202.30) 12.11.20 80 0
337980 j쿼리 책 추천좀 [2] ㅇㅁㄴㅇ(59.11) 12.11.20 53 0
337979 그러고 보면 많은 사람들이 자기 아이디어가 진짜 개쩌는 줄 알고 [3] 영꼰이갤로그로 이동합니다. 12.11.20 105 0
337978 요즘은 "어떡해" 라는 분 안오시나 69(202.30) 12.11.20 60 0
337977 아래 게임 기획 뭐 관련된 글 보니까 이게 생각났다. [2] 잇힝유후♪갤로그로 이동합니다. 12.11.20 66 0
337976 폰트 검색 서비스 어떰? [11] 영꼰이갤로그로 이동합니다. 12.11.20 168 0
337975 그래서 나랑같이 겜제작 공부할사람? d3d시방것(180.71) 12.11.20 34 0
337974 게임도 기술적 이해가 깊은 사람이 기획해야 된다. [1] 영꼰이갤로그로 이동합니다. 12.11.20 77 1
337973 혹시 폰트 잘 알아보는 매의눈 있쌈? [7] 부끄곰갤로그로 이동합니다. 12.11.20 93 0
337972 우리가 좋은 프로그램을 가질수없는이유 [1] ㅇㅇ(61.77) 12.11.20 62 0
337970 느덜 프로그래머인데 주식도 못하냐..? 난 200으로 8천 만들었다 [5] Margin Call갤로그로 이동합니다. 12.11.20 171 0
337969 솔직히 게임은 디자이너가 더 중요하지 프로그래머는 거들뿐 초딩6(59.13) 12.11.20 64 0
337967 대박아이디어있는데 월급은 못드림 그리고 고졸이라고? [1] 얼룩돼지갤로그로 이동합니다. 12.11.20 77 0
337966 기획자 - 개발자와 같은 일이 제조업에서도 벌어지는데.. ☎2.51™갤로그로 이동합니다. 12.11.20 49 0
337964 내가 만들어 보고 싶은 게임은.. ㅇㅇ [9] ☎2.51™갤로그로 이동합니다. 12.11.20 124 0
337963 내가 게임 기획자 하면 딱일 것 같은데. ㅇㅇ [5] ☎2.51™갤로그로 이동합니다. 12.11.20 89 1
337962 이거 자료구조 어케 짜야함?? [4] 도와줭(175.244) 12.11.20 73 0
337961 저격-사랑돋긔 [6] 69(202.30) 12.11.20 157 0
337959 밑에 앱창업 비전공자가 어쩌고저쩌고... [8] 안녕(175.192) 12.11.20 197 0
337958 하나만썼으면좋겠다 [4] 사랑돋긔갤로그로 이동합니다. 12.11.20 185 0
337956 혹시 NHN 맴버십 예비과정 붙으신분 'ㅡ' 헤헤 [2] 납땜왕(203.252) 12.11.20 146 0
337955 형들 뭐가 잘못된건지 모르겠어... [1] ㅎㅇ(112.186) 12.11.20 31 0
337954 간단하게 온라인게임만들려고하는데 감이 안잡히네요; [5] (121.145) 12.11.20 92 0
뉴스 츄(CHUU), 영화 '첫사랑 엔딩' 컬래버 음원 가창 참여! 21일 'Loveholic' 발매 디시트렌드 07.17
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2