디시인사이드 갤러리

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

갤러리 본문 영역

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

횽들봐줘(220.67) 2012.12.04 15:24:14
조회 185 추천 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/07 - -
339789 요즘에도 [3] 이런(211.234) 12.12.05 45 0
339788 ms야 mfc 버리면 안되.. [6] ㅇㅇ(58.102) 12.12.05 197 0
339787 왜 자바스크립트가 적용이 됬다가 안됬다가 하는걸까요?? [7] 용인고자라인(182.215) 12.12.05 93 0
339786 안드로이드 Fragment로 자바액티비티 파일 어떻게 적용시켜?? [2] dd(123.140) 12.12.05 62 0
339785 형들 gif파일을 읽어서 화면에 직접 그리고싶은데 [1] 123(112.165) 12.12.05 49 0
339784 암호학 프로그래밍 짜고 있는데. 도와줍쇼. [6] AES(122.254) 12.12.05 168 0
339783 열심히 공부해라 [2] df(59.26) 12.12.05 137 0
339782 프갤이 활발해지려면 어떻게해야할까 [6] ㅋㄱ(183.96) 12.12.05 125 0
339781 보통 3dmax로 자기가원하는 모델링 만들정도 수준될려면 몇개월공부? [5] 유니티(121.176) 12.12.05 99 0
339780 유니티vs자바 [2] 유니티(121.176) 12.12.05 146 0
339779 이클립스에서 mysql url 설정해야 하는데 [1] JSP(182.211) 12.12.05 37 0
339778 우리회사 월급은 꼬박 잘주는데 너무 힘들다.. [3] ㅇㅇ(175.194) 12.12.05 99 0
339777 유니티로 게임만들까 자바로게임만들까? [1] 유니티(121.176) 12.12.05 86 0
339776 아오 왜 팀으로 작업해야하는걸 늘 혼자 작업해야하는거야? [4] Aven갤로그로 이동합니다. 12.12.05 123 0
339775 프로그래밍의 언어중에 가장 유망주는 무엇일까? [12] 새싹(211.210) 12.12.05 285 0
339774 형들은 irc 머써? [1] 힝아(115.161) 12.12.05 60 0
339773 나 미국 컴퓨터 사이언스 대학원 가는데 [3] Dssafhjrfv갤로그로 이동합니다. 12.12.04 227 0
339772 간만의 지식탐구 [1] 이모군(58.228) 12.12.04 33 0
339771 개인 페이지에 유튜브 뮤비 퍼오는 건 문제 없겠지? [4] 매의눈(59.14) 12.12.04 65 0
339770 아 화상인바이러스인가에 나온 cyber bitch 이쁘다 Kyle(220.244) 12.12.04 105 1
339768 근데 홈페이지에 외국노래 배경음악으로 깔아놓으면 저작권 걸림? [3] 매의눈(59.14) 12.12.04 83 0
339767 '와이파이 + 지메일' 은 절대 추적 불가? [2] 갤러그(119.194) 12.12.04 291 0
339765 First Follow yacc yacc 퍼스트 팔로우 얔얔 [2] ㅋㄱ(183.96) 12.12.04 80 0
339764 형들 질문점.. [1] 자바뉴비ㅠㅠ(203.241) 12.12.04 42 0
339762 부럽다 나도 어디 입사해보고싶다 하스갤로그로 이동합니다. 12.12.04 36 0
339761 벌레잡기로 스트레스 푸는 형들은 [2] 하스갤로그로 이동합니다. 12.12.04 68 0
339759 입사하면 누군 좋아할거같아? [3] ㅋㄱ(183.96) 12.12.04 157 0
339757 코딩 초보한테 이것 좀 도와주라 ;;; [2] 프갤러들아 (121.150) 12.12.04 80 0
339756 티비토론 보고있냐 [3] 고랭?갤로그로 이동합니다. 12.12.04 92 0
339755 무슨 1학년 2학기에....5천줄짜리 코드 과제여 [11] (220.94) 12.12.04 211 0
339753 전자과 OS관련 [3] dropsipss1(223.62) 12.12.04 127 0
339751 근데 왜 프갤에서 프로그래밍 질문하냐 하스갤로그로 이동합니다. 12.12.04 42 0
339750 프로그램수정을 [10] ㅂㅈㄷ(1.220) 12.12.04 180 0
339749 형들 오늘 고딩한테 담배를 사줬어 [2] 꿈꾸는낭만갤로그로 이동합니다. 12.12.04 113 0
339747 안드로이드 Fragment 잘하는 형 없음? [1] dd(210.94) 12.12.04 45 0
339746 여기잇는사람들 답없다 [2] 겟앰푸딩(220.120) 12.12.04 87 0
339745 전처리기는 디버깅 안되냐 [2] (203.237) 12.12.04 58 0
339744 운전면허필기 만점받음 ㅋㅋ ㅗㅗ (121.174) 12.12.04 51 0
339743 자바 안드로이드 두더지게임 만들어야되는데 네이트로 도와주실분... [2] 예비군아저씨갤로그로 이동합니다. 12.12.04 114 0
339742 파스칼 소스는 구했는데 할매문자근성(119.208) 12.12.04 54 0
339741 자료구조는 근데 [1] 겟앰푸딩(220.120) 12.12.04 79 0
339740 백왕 어드밴쳐 2탄 - 곽노현 .txt Kyle(220.244) 12.12.04 50 0
339739 님들 꼭와주셈 자료구조 공부법 [3] 자료구조(220.120) 12.12.04 430 0
339738 백왕 어드밴쳐 1탄.txt Kyle(220.244) 12.12.04 40 0
339736 이야 쩐다 ㅇㅇ가 보면 분노할 동영상이 떴네 [1] JSP(182.211) 12.12.04 78 0
339735 C프로그래밍 질문있다 도와주라 [7] 씨벌(166.104) 12.12.04 122 0
339734 프로그래머 하려는 새끼가 잴불쌍.. 차라리 일용직 잡부가... [2] 미쿸사람(125.185) 12.12.04 197 0
339732 비전공자가 학원다니면 it일자리 못구함? [2] ㅇㅇ(61.77) 12.12.04 251 0
339730 후....... 이력서 쓰는것도 지겹다. [1] JSP(182.211) 12.12.04 84 0
339729 자바뉴비가 질문좀 할께요 너무 급해서 ㅠ 자바뉴비ㅠㅠ(119.208) 12.12.04 53 0
뉴스 “역시 부자는 다르다”…서장훈, ‘재혼’ 이상민에 ‘헉’ 소리 나는 축의금 디시트렌드 10:00
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2