디시인사이드 갤러리

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

갤러리 본문 영역

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

횽들봐줘(220.67) 2012.12.04 15:24:14
조회 186 추천 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 - -
339847 바빠죽겠는데넘우울해... [2] 모모(211.234) 12.12.05 53 0
339846 c++ 간단한거 질문점 ㅠ.ㅠ [13] 잉여잉여(14.33) 12.12.05 148 0
339845 php date() [4] ㅋㅌㅊ(1.220) 12.12.05 58 0
339844 이거 취업잘하는거야? [12] ㅇㅇ(121.140) 12.12.05 294 1
339843 그런데 확실히 보통 앱 개발보단 게임 개발이 훨씬 재미진듯 [1] 하스갤로그로 이동합니다. 12.12.05 110 0
339841 요즘 개발자 대우는 좀 어떰?? 여전히 야근에 쩔음? [1] JSP(182.211) 12.12.05 117 0
339840 나는 죽어도 안드로이드 비트맵이랑 캔버스 못다루겠다 [1] 하스갤로그로 이동합니다. 12.12.05 46 0
339838 (질문) 여친이 혼전 순결을 강요한다면? [4] JSP(182.211) 12.12.05 213 0
339836 관계형 데이터 베이스 밖에 모르는데 객체형 데이터베이스 써본 횽? [3] JSP(182.211) 12.12.05 103 0
339835 냉동실에 잠깐 넣어놨던 콜라 꺼냈는데 하스갤로그로 이동합니다. 12.12.05 38 0
339834 게임엔진 만들건데 [3] 하스갤로그로 이동합니다. 12.12.05 90 0
339833 matlab 즂 고수 형잇어?나 정말 절실해 도와줘 ㅠ [1] 헬로우우자아아갤로그로 이동합니다. 12.12.05 34 0
339832 요즘 놀면서 독학하고 있는데 이건 진짜 외로운 싸움인듯 [4] JSP(182.211) 12.12.05 120 0
339830 프갤러들아 오라클 질문좀 [6] Adelposs갤로그로 이동합니다. 12.12.05 52 0
339829 요즘 응용프로그래머랑 시스템 프로그래머는 어때?? JSP(182.211) 12.12.05 59 0
339828 tv토론 어헐헐 [5] 이모군(58.228) 12.12.05 58 0
339827 아악 ㅋㅋㅋ 너무 부끄럽다 /엉엉 [3] JSP(182.211) 12.12.05 53 0
339826 ie8 이상에서 호환성 모드로 안 바뀌게 강제할 수 없냐? [7] ㅁㄴㄻㄹ갤로그로 이동합니다. 12.12.05 196 0
339825 php 와 mysql이 망하지않는이유 [3] Kyle(220.244) 12.12.05 199 1
339824 자바 스레드질문점... [3] aldrich갤로그로 이동합니다. 12.12.05 43 0
339823 이상하게 우리 나라에서 잘 안쓰는 언어들 [2] ㅇㅇ(58.102) 12.12.05 112 0
339822 형들 존나 진지하다 좀봐줘 [2] 오세만형님(203.232) 12.12.05 53 0
339820 눈오는데 뭐 시켜먹는건 하지 말아야겠지? ㅋㄱ(183.96) 12.12.05 38 0
339819 JSP에서 db 커넥션을 분리 했는데 클래스파일 복사해서 쓰면 안되?? [1] JSP(182.211) 12.12.05 32 0
339818 ajax 잘하는사람 있냐 [2] ㅇㄴㅁㅇㄴㅁ(59.11) 12.12.05 58 0
339817 여기 ajax 잘하는사람 있냐 [1] ㅇㄴㅁㅇㄴㅁ(59.11) 12.12.05 49 0
339816 아 페이지 컨트롤러 오랜만에 하려니까 빡쳐영 24(14.32) 12.12.05 15 0
339815 횽들 my sql 설치 이상해서 질문해염 초오보(58.76) 12.12.05 27 0
339814 페이지 크기와 page fault rate하고 관련이 왜 있는거야??? [2] ㅇㅇ(203.90) 12.12.05 55 0
339813 뉴욕지하철 한인 떠밀어 흑인 잡고 보니…정신질환자 에어로홍갤로그로 이동합니다. 12.12.05 52 0
339812 난 외국에서 여자 사와서 결혼하는거 반대하는 입장인데.. [2] ㅇㅇ(58.102) 12.12.05 89 0
339811 오픈소스 발음할때 오픈싸우스~ 막 이러면서 open sauce 개그치는애 [1] Kyleㅇ(220.244) 12.12.05 71 0
339809 형들 콧물이폭발해염 [1] WannaParty갤로그로 이동합니다. 12.12.05 49 0
339808 정수정아~ 보고 있어 ? 밖에 눈이 내리고 있어~ [2] ☎2.52™갤로그로 이동합니다. 12.12.05 103 0
339807 배신자온 로그인 오류 어떻게 해야 로그인 할수 잇을까요??? 343434(210.98) 12.12.05 366 0
339806 연예따윈 집어치우고 국제결혼 하려는데 [5] ㅈㅈ(1.214) 12.12.05 112 0
339805 구글맵에서 지금 동해가 일본해로 표기되어있다네 ㅡ,.ㅡ;; 얼룩돼지갤로그로 이동합니다. 12.12.05 38 0
339804 형들 눈이와염 WannaParty갤로그로 이동합니다. 12.12.05 44 0
339803 눈 치웠음 이모군(58.228) 12.12.05 17 0
339802 아 학교에서 연락이 안온다 아오 ㅅㅂ Kyleㅇ(220.244) 12.12.05 64 0
339801 다들야근수당은 받고있어?? [2] ㅋㅋ(211.234) 12.12.05 70 0
339800 난빨라는 빠릅니다 [2] 난빨라갤로그로 이동합니다. 12.12.05 418 0
339799 고수님들 이것좀 도와줄래여? [1] 야바람(2.98) 12.12.05 49 0
339797 형들 우리나라가 프로그래머 대우가 안좋다고들 하잖아 [6] ㅇㅇ(183.100) 12.12.05 199 0
339796 내가 짠프로그램이 버그없이 잘돌아가면 불안하지 않음? [6] 나리링갤로그로 이동합니다. 12.12.05 178 0
339795 visual studio 2012 설치중~ [2] 상상(175.123) 12.12.05 82 0
339794 스마트TV앱 취업설명회!!! [2] 방강혁(121.140) 12.12.05 63 0
339793 C++로 GUI 개발하는 거 자체가 삽질이지 [4] 가나다라마법(112.173) 12.12.05 225 0
339792 C++로 GUI 개발하고 싶은 프게이들아 [7] ㅁㄴㅇ(119.202) 12.12.05 204 0
339791 언제나 네이밍이 제일 힘들다 [2] ㅇㅇ(58.102) 12.12.05 78 0
뉴스 '남주의 첫날밤을 가져버렸다' 서현-옥택연, 스타일부터 분위기까지 완벽 케미! 캐릭터 맞춤 전통美 의상에 시선 집중! 디시트렌드 07.07
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2