마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

FATAL EXCEPTION:main 에러가납니다 도와주세요.

–4 추천
package com.mycross_ap3;
 
import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
 
public class Level1 extends Activity {
 
TextDialog dialog;
int hintcount = 0;
int char3 = 2;
int char4 = 3;
String Level1_HINT[] = { "HINT1", "HINT2", "HINT3", "HINT4" };
TextView[][] answerlist;
 
void charselecter(int select,int charr, int width, int height,boolean WH){
final int selectNUM = select;
final int Width = width; final int Height = height;
int charNUM = charr;
 
if(WH==true){ //가로일때
for (int i = 0; i <= charNUM; i++) {
answerlist[Height][Width+i].setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
TextDialog.temp = selectNUM;
dialog.show();
}
});
}
}else{
for (int i = 0; i <= charNUM; i++) {
answerlist[height+i][Width].setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
TextDialog.temp = selectNUM;
dialog.show();
}
});
}
}
}
 
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_level1);
 
TextView[][] answerlist = { // 퍼즐
// 1line
{(TextView) findViewById(R.id.xy00),// first [0]
(TextView) findViewById(R.id.xy10),
(TextView) findViewById(R.id.xy20),
(TextView) findViewById(R.id.xy30),
(TextView) findViewById(R.id.xy40)},
// 2line
{(TextView) findViewById(R.id.xy01),
(TextView) findViewById(R.id.xy11),
(TextView) findViewById(R.id.xy21),
(TextView) findViewById(R.id.xy31),
(TextView) findViewById(R.id.xy41)},
// 3line
{(TextView) findViewById(R.id.xy02),
(TextView) findViewById(R.id.xy12),
(TextView) findViewById(R.id.xy22), // center [12]
(TextView) findViewById(R.id.xy32),
(TextView) findViewById(R.id.xy42)},
// 4line
{(TextView) findViewById(R.id.xy03),
(TextView) findViewById(R.id.xy13),
(TextView) findViewById(R.id.xy23),
(TextView) findViewById(R.id.xy33),
(TextView) findViewById(R.id.xy43)},
// 5line
{(TextView) findViewById(R.id.xy04),
(TextView) findViewById(R.id.xy14),
(TextView) findViewById(R.id.xy24),
(TextView) findViewById(R.id.xy34),
(TextView) findViewById(R.id.xy44), }}; // last [24]
 
 
// 힌트
final TextView HINTVIEW = (TextView) findViewById(R.id.HINTTEXT);
 
// 다이얼로그생성
dialog = new TextDialog(Level1.this);
// dialog.setTitle("dialog");
 
 
switch (TextDialog.level_NUM) {
case 0:
// 공백부분제거
answerlist[0][4].setVisibility(View.INVISIBLE);
answerlist[1][1].setVisibility(View.INVISIBLE);
answerlist[1][2].setVisibility(View.INVISIBLE);
answerlist[1][3].setVisibility(View.INVISIBLE);
answerlist[2][3].setVisibility(View.INVISIBLE);
answerlist[3][0].setVisibility(View.INVISIBLE);
answerlist[3][2].setVisibility(View.INVISIBLE);
answerlist[3][3].setVisibility(View.INVISIBLE);
answerlist[4][0].setVisibility(View.INVISIBLE);
HINTVIEW.setText(Level1_HINT[0]);
 
// 버튼생성
charselecter(0,3,0,0,true);
 
// 레벨별 디스미스리스너
dialog.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if (TextDialog.msg.equals(TextDialog.answertemp[TextDialog.temp])) {
// 가로지문
 
}
}
});
break;
 
case 1:
 
break;
 
case 2:
 
break;
}
}
 
/*
* final AlertDialog.Builder builder = new AlertDialog.Builder(this);
* LayoutInflater inflater = this.getLayoutInflater();
* builder.setView(inflater.inflate(R.layout.activity_dialog, null));
* builder.setCancelable(true);
*/
 
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.level1, menu);
return true;
}
 
}
 
초보안드로이 (170 포인트) 님이 2014년 1월 25일 질문
에러가

FATAL EXCEPTION:main
(치명적인 에러 : main 이라는 뜻)
이라고 하면 어떻게 찾나요. 라인 번호와 익섭션이 뭔지 알아야 왜 튕기는지 찾지요

1개의 답변

+2 추천
설마..답변자들이 일일이 프로그램을 만들어서 소스코드를 넣고 실행해보리라는 생각은 아니겠죠...?

어디서 에러가 나는지 뜰텐데 그 정보와 함께 소스코드를 올려줬으면 답이 달리리라 생각됩니다.
인연 (31,880 포인트) 님이 2014년 1월 28일 답변
...