디시인사이드 갤러리

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

갤러리 본문 영역

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

횽들봐줘(220.67) 2012.12.04 15:24:14
조회 188 추천 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 - -
공지 프로그래밍 갤러리 이용 안내 [88] 운영자 20.09.28 45354 65
2870882 3617번이라고한다 헬마스터갤로그로 이동합니다. 22:33 1 0
2870881 켄트백 그래도 페북 7년있었잖아. ㅆㅇㅆ(124.216) 22:32 3 0
2870880 나님 유튜브 시청하며 ai 공부중 [3] 아스카영원히사랑해갤로그로 이동합니다. 22:30 7 0
2870879 근데 지피티 쓰면 코드 못쓰게 되는게 당연한 수순임. 이건 어쩔수가 없어 [6] ㅆㅇㅆ(124.216) 22:21 38 0
2870878 ❤✨☀⭐⚡☘♥+나님 시작합니당♥+☘⚡⭐☀✨❤ [1] ♥냥덩이♥갤로그로 이동합니다. 22:20 9 0
2870877 아 이제 지피티 없이 개발 못하겠네.. [2] ㅇㅇ(175.197) 22:18 12 0
2870876 마갤은 취향 안맞아서 정갤에서 정신병 뽐내는게 좋아 [2] ㅆㅇㅆ(124.216) 22:16 10 0
2870875 다 깃허브갤로 이사갔네 [2] 프갤러(106.101) 22:14 17 0
2870874 2주동안 하던 문명 한판 끝냈습니다 [4] 아스카영원히사랑해갤로그로 이동합니다. 22:14 13 0
2870873 근데 보통 Cpp17 핵심 컨셉이 스트럭쳐 바인딩이라 ㅆㅇㅆ(124.216) 22:06 12 0
2870871 근데 대부분 11기준 서술이라 11기준이면 여전히 유효하긴함 [3] ㅆㅇㅆ(124.216) 22:01 28 0
2870870 c++책 다 버렸음 [2] ㅇㅇ(122.36) 21:52 44 0
2870868 sism도 자유롭게 휴가를 쓰고싶어요 [5] 개멍청한유라갤로그로 이동합니다. 21:32 27 0
2870866 로그는 누가만들었을까 [4] 개멍청한유라갤로그로 이동합니다. 21:26 41 0
2870864 내부고발자를 조심해야하는 이유.... ㅇㅇㅇㅇ(125.7) 21:19 14 0
2870863 애널 하루도 2재명 만큼 대한민국이 망해가는구낭.. ♥냥덩이♥갤로그로 이동합니다. 21:11 19 0
2870862 ❤✨☀⭐⚡☘♥+나님 시작합니당♥+☘⚡⭐☀✨❤ ♥냥덩이♥갤로그로 이동합니다. 20:51 17 0
2870861 나님 다른 프밍갤 갈만한곳 ㅊㅊ 받음 [2] ♥냥덩이♥갤로그로 이동합니다. 20:43 37 0
2870860 163 [2] ♥냥덩이♥갤로그로 이동합니다. 20:30 19 0
2870858 개인정보처리방침 만드는거 빡세네 ㅎㅎ 루비갤로그로 이동합니다. 20:05 19 0
2870856 ㅆㅇㅆ 그록4써봄? [1] ㅇㅇ(211.38) 20:00 28 0
2870855 나님 기도합니당❤+ [1] ♥냥덩이♥갤로그로 이동합니다. 20:00 20 0
2870854 코린이 지도편달 부탁드립다 프갤러(211.36) 20:00 12 0
2870853 그렇다고 민주당 지지하는것도 아님 ㅇㅅㅇ [1] 류류(125.244) 19:41 22 1
2870852 예전에야 나도 보수지지했는데 ㅇㅅㅇ 류류(125.244) 19:41 15 0
2870851 정치병자들은 하나같이 야옹이 좋아하네 류류(125.244) 19:39 11 0
2870850 민주당 계열 정신병자는 야옹아저씨고 류류(125.244) 19:37 13 0
2870849 윤석열 무기징역 당했음 좋겠다 ㅇㅅㅇ 류류(125.244) 19:36 13 0
2870848 나님 탈갤합니당⭐+ [1] ♥냥덩이♥갤로그로 이동합니다. 19:36 19 0
2870847 뚱뚱한데 친절한녀 귀엽지않냐? [6] 헬마스터갤로그로 이동합니다. 19:13 43 0
2870846 냥덩이를 정신병자 스토커 멍유한테서 구해줄 영웅은 없는걸깡..? [3] ♥냥덩이♥갤로그로 이동합니다. 18:57 39 0
2870845 한국인이라는 사실 자체가 언제나 부끄럽고 수치스럽다. 나는 사람이고 싶다 [2] ㅆㅇㅆ(124.216) 18:35 44 0
2870844 LTV보다는 Y1 수익에 집중하는 태도 그게 바로 한국인. [1] ㅆㅇㅆ(124.216) 18:29 32 0
2870843 헉..! [1] ♥냥덩이♥갤로그로 이동합니다. 18:28 20 0
2870842 ❤✨☀⭐나님 시작합니당⭐☀✨❤ ♥냥덩이♥갤로그로 이동합니다. 18:25 11 0
2870841 트럼프의 좌파 카르텔 대청소 리재명 때문에 한국사람들만 피해본다 ♥냥덩이♥갤로그로 이동합니다. 18:22 22 0
2870840 좌파의 특권의식과 이중성 ♥냥덩이♥갤로그로 이동합니다. 18:21 14 0
2870839 한국 환경이랑 해외환경 차이는 카톡이랑 텔레그램만봐도 앎. ㅆㅇㅆ(124.216) 18:13 31 0
2870838 현업 7년차인데 코딩테스트 개조졌음 [5] 프갤러(211.218) 18:08 64 0
2870837 집에가자 [1] 개멍청한유라갤로그로 이동합니다. 18:07 25 0
2870836 텔레그램 봇 지원해주는게 참 좋긴함. 왜 카톡은 그렇게 안할까 [1] ㅆㅇㅆ(124.216) 18:07 25 0
2870835 텔레그램 얘기 나와서 하는 말인데 카톡 솔직히 병신임 [2] 프갤러(218.154) 18:00 34 0
2870834 텔레그램이 왜 유명한거임 [3] ㅇㅇ(164.125) 17:51 38 0
2870833 누가 멍유 스토킹 좀 막아주면 나님 ㄹㅇ 탈갤함 [2] ♥냥덩이♥갤로그로 이동합니다. 17:50 30 0
2870832 하이닉스 평단 295,000원에 들어감 ㅜㅠ [1] ㅇㅇ(39.7) 17:40 29 0
2870831 ■컴공과에서 개발자, 전산말고 다른 진로는 없나요 [3] ㅇㅇ갤로그로 이동합니다. 17:37 51 0
2870829 어깨 아프다 [4] 루도그담당(211.235) 16:43 33 0
2870828 연봉인상 15%면 많이 오른거냐 [3] 프갤러(220.87) 16:16 58 0
2870827 군대에서 이거 진짜 된적 있나요? [8] 프갤러(106.101) 15:57 55 0
뉴스 ‘불후의 명곡’ 임영웅 최초 단독 특집 편성! 찐친 군단과의 레전드 무대 예고! 디시트렌드 14:00
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2