어플실행시키고 이미지버튼눌러서 다른 페이지로 넘어가려고할때 어플이 죽습니다.
로그캣에는 java.lang.ClassCastException : android.widjet.Imagebutton 이런 에러가나오는데
이미지버튼쪽이 문제인거같은데 .. 소스에는 에러도안뜨고해서 어디가 잘못됬는지
자세히 모르겠네요 ,, ㅠ 도움좀 주세요 ,, java파일 xml파일 올려봅니다 ..
package com.uc.UCLicense;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.LinearLayout;
public class p2_exam extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.exam_main);
LinearLayout exam08_1 = (LinearLayout) this.findViewById(R.id.exam081);
exam08_1.setOnClickListener((OnClickListener) this);
LinearLayout exam08_2 = (LinearLayout) this.findViewById(R.id.exam082);
exam08_2.setOnClickListener((OnClickListener) this);
LinearLayout exam08_3 = (LinearLayout) this.findViewById(R.id.exam083);
exam08_3.setOnClickListener((OnClickListener) this);
LinearLayout exam08_4 = (LinearLayout) this.findViewById(R.id.exam084);
exam08_4.setOnClickListener((OnClickListener) this);
LinearLayout exam09_1 = (LinearLayout) this.findViewById(R.id.exam091);
exam09_1.setOnClickListener((OnClickListener) this);
LinearLayout exam09_2 = (LinearLayout) this.findViewById(R.id.exam092);
exam09_2.setOnClickListener((OnClickListener) this);
LinearLayout exam09_3 = (LinearLayout) this.findViewById(R.id.exam093);
exam09_3.setOnClickListener((OnClickListener) this);
LinearLayout exam09_4 = (LinearLayout) this.findViewById(R.id.exam094);
exam09_4.setOnClickListener((OnClickListener) this);
LinearLayout exam10_1 = (LinearLayout) this.findViewById(R.id.exam101);
exam10_1.setOnClickListener((OnClickListener) this);
LinearLayout exam10_2 = (LinearLayout) this.findViewById(R.id.exam102);
exam10_2.setOnClickListener((OnClickListener) this);
LinearLayout exam10_3 = (LinearLayout) this.findViewById(R.id.exam103);
exam10_3.setOnClickListener((OnClickListener) this);
LinearLayout exam10_4 = (LinearLayout) this.findViewById(R.id.exam104);
exam10_4.setOnClickListener((OnClickListener) this);
LinearLayout exam11_1 = (LinearLayout) this.findViewById(R.id.exam111);
exam11_1.setOnClickListener((OnClickListener) this);
LinearLayout exam11_2 = (LinearLayout) this.findViewById(R.id.exam112);
exam11_2.setOnClickListener((OnClickListener) this);
LinearLayout exam11_3 = (LinearLayout) this.findViewById(R.id.exam113);
exam11_3.setOnClickListener((OnClickListener) this);
LinearLayout exam11_4 = (LinearLayout) this.findViewById(R.id.exam114);
exam11_4.setOnClickListener((OnClickListener) this);
}
//@Override
public void onClick(View v) { //v는 변수
switch(v.getId())
{
case R.id.exam081 :
Intent a = new Intent(this, exam08_1.class);
startActivity(a);
break;
case R.id.exam082 :
Intent b = new Intent(this, exam08_2.class);
startActivity(b);
break;
case R.id.exam083 :
Intent c = new Intent(this, exam08_3.class);
startActivity(c);
break;
case R.id.exam084 :
Intent d = new Intent(this, exam08_4.class);
startActivity(d);
break;
case R.id.exam091 :
Intent e = new Intent(this, exam09_1.class);
startActivity(e);
break;
case R.id.exam092 :
Intent f = new Intent(this, exam09_2.class);
startActivity(f);
break;
case R.id.exam093 :
Intent g = new Intent(this, exam09_3.class);
startActivity(g);
break;
case R.id.exam094 :
Intent h = new Intent(this, exam09_4.class);
startActivity(h);
break;
case R.id.exam101 :
Intent i = new Intent(this, exam10_1.class);
startActivity(i);
break;
case R.id.exam102 :
Intent j = new Intent(this, exam10_2.class);
startActivity(j);
break;
case R.id.exam103 :
Intent k = new Intent(this, exam10_3.class);
startActivity(k);
break;
case R.id.exam104 :
Intent l = new Intent(this, exam10_4.class);
startActivity(l);
break;
case R.id.exam111 :
Intent m = new Intent(this, exam11_1.class);
startActivity(m);
break;
case R.id.exam112 :
Intent n = new Intent(this, exam11_2.class);
startActivity(n);
break;
case R.id.exam113 :
Intent o = new Intent(this, exam11_3.class);
startActivity(o);
break;
case R.id.exam114 :
Intent p = new Intent(this, exam11_4.class);
startActivity(p);
break;
}
ImageButton aa = (ImageButton)findViewById(R.id.exam081); //exam08_1는 변수
aa.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam08_1.class);
startActivity(intent);
}
});
ImageButton bb = (ImageButton)findViewById(R.id.exam082);
bb.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam08_2.class);
startActivity(intent);
}
});
ImageButton cc = (ImageButton)findViewById(R.id.exam083);
cc.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam08_3.class);
startActivity(intent);
}
});
ImageButton dd = (ImageButton)findViewById(R.id.exam084);
dd.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam08_4.class);
startActivity(intent);
}
});
ImageButton ee = (ImageButton)findViewById(R.id.exam091);
ee.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam09_1.class);
startActivity(intent);
}
});
ImageButton ff = (ImageButton)findViewById(R.id.exam092);
ff.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam09_2.class);
startActivity(intent);
}
});
ImageButton gg = (ImageButton)findViewById(R.id.exam093);
gg.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam09_3.class);
startActivity(intent);
}
});
ImageButton hh = (ImageButton)findViewById(R.id.exam094);
hh.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam09_4.class);
startActivity(intent);
}
});
ImageButton ii = (ImageButton)findViewById(R.id.exam101);
ii.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam10_1.class);
startActivity(intent);
}
});
ImageButton jj = (ImageButton)findViewById(R.id.exam102);
jj.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam10_2.class);
startActivity(intent);
}
});
ImageButton kk = (ImageButton)findViewById(R.id.exam103);
kk.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam10_3.class);
startActivity(intent);
}
});
ImageButton ll = (ImageButton)findViewById(R.id.exam104);
ll.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam10_4.class);
startActivity(intent);
}
});
ImageButton mm = (ImageButton)findViewById(R.id.exam111);
mm.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam11_1.class);
startActivity(intent);
}
});
ImageButton nn = (ImageButton)findViewById(R.id.exam112);
nn.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam11_2.class);
startActivity(intent);
}
});
ImageButton oo = (ImageButton)findViewById(R.id.exam113);
oo.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam11_3.class);
startActivity(intent);
}
});
ImageButton pp = (ImageButton)findViewById(R.id.exam114);
pp.setOnClickListener(new ImageButton.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(p2_exam.this, exam11_4.class);
startActivity(intent);
}
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <FrameLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/p2_bg"
android:alwaysDrawnWithCache="true"
/>
<!-- 2008기출문제 -->
<ImageView
android:layout_marginBottom="350dip"
android:layout_height="60px"
android:scaleType="fitXY"
android:src="@drawable/p2_button_2008exam"
android:layout_gravity="bottom|center"
android:onClick="clickButton"
android:layout_marginLeft="20px"
android:background="#00000000"
android:layout_width="300px">
</ImageView>
<ImageButton
android:id="@+id/exam081"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="310dip"
android:scaleType="fitXY"
android:layout_marginLeft="150px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no1"
/>
<ImageButton
android:id="@+id/exam082"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="310dip"
android:scaleType="fitXY"
android:layout_marginLeft="200px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no2"
/>
<ImageButton
android:id="@+id/exam083"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="310dip"
android:scaleType="fitXY"
android:layout_marginLeft="250px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no3"
/>
<ImageButton
android:id="@+id/exam084"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="310dip"
android:scaleType="fitXY"
android:layout_marginLeft="300px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no4"
/>
<!-- 2009기출문제 -->
<ImageView
android:layout_marginBottom="260dip"
android:layout_height="60px"
android:scaleType="fitXY"
android:src="@drawable/p2_button_2009exam"
android:layout_gravity="bottom|center"
android:onClick="clickButton"
android:layout_marginLeft="20px"
android:background="#00000000"
android:layout_width="300px">
</ImageView>
<ImageButton
android:id="@+id/exam091"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="220dip"
android:scaleType="fitXY"
android:layout_marginLeft="150px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no1"
/>
<ImageButton
android:id="@+id/exam092"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="220dip"
android:scaleType="fitXY"
android:layout_marginLeft="200px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no2"
/>
<ImageButton
android:id="@+id/exam093"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="220dip"
android:scaleType="fitXY"
android:layout_marginLeft="250px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no3"
/>
<ImageButton
android:id="@+id/exam094"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="220dip"
android:scaleType="fitXY"
android:layout_marginLeft="300px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no4"
/>
<!-- 2010기출문제 -->
<ImageView
android:layout_width="300px"
android:layout_height="60px"
android:layout_gravity="bottom|center"
android:layout_marginBottom="170dip"
android:scaleType="fitXY"
android:layout_marginLeft="20px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_2010exam"/>
<ImageButton
android:id="@+id/exam101"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="130dip"
android:scaleType="fitXY"
android:layout_marginLeft="150px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no1"
/>
<ImageButton
android:id="@+id/exam102"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="130dip"
android:scaleType="fitXY"
android:layout_marginLeft="200px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no2"
/>
<ImageButton
android:id="@+id/exam103"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="130dip"
android:scaleType="fitXY"
android:layout_marginLeft="250px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no3"
/>
<ImageButton
android:id="@+id/exam104"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="130dip"
android:scaleType="fitXY"
android:layout_marginLeft="300px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no4"
/>
<!-- 2011기출문제 -->
<ImageView
android:layout_width="300px"
android:layout_height="60px"
android:layout_gravity="bottom|center"
android:layout_marginBottom="80dip"
android:scaleType="fitXY"
android:layout_marginLeft="20px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_2011exam"/>
<ImageButton
android:id="@+id/exam111"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="40dip"
android:scaleType="fitXY"
android:layout_marginLeft="150px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no1"
/>
<ImageButton
android:id="@+id/exam112"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="40dip"
android:scaleType="fitXY"
android:layout_marginLeft="200px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no2"
/>
<ImageButton
android:id="@+id/exam113"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="40dip"
android:scaleType="fitXY"
android:layout_marginLeft="250px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no3"
/>
<ImageButton
android:id="@+id/exam114"
android:layout_width="50px"
android:layout_height="60px"
android:layout_gravity="bottom|left"
android:layout_marginBottom="40dip"
android:scaleType="fitXY"
android:layout_marginLeft="300px"
android:background="#00000000"
android:onClick="clickButton"
android:src="@drawable/p2_button_no4"
/>
</FrameLayout>
</ScrollView>




xml 에는 ImageButton으로 정의하셨는데 소스에서는 LinearLayout으로 Casting을 시도하고 있습니다...