제가이번에 과제로 게임하나를 만들고있는데요
현재 레이아웃은 다 짜논상태이구요
게임도 어느정도는 구현한상태인데 문제는
각각짜논 레이아웃을 합치면 화면을 이동할때
07-24 06:49:17.029: DEBUG/dalvikvm(178): GC_EXPLICIT freed 96 objects / 8472 bytes in 258ms
07-24 06:49:22.119: DEBUG/dalvikvm(314): GC_EXPLICIT freed 22 objects / 1008 bytes in 330ms
07-24 06:49:27.119: DEBUG/dalvikvm(193): GC_EXPLICIT freed 565 objects / 31752 bytes in 321ms
07-24 06:49:43.989: INFO/ActivityManager(71): Starting activity: Intent { cmp=com.FlightPlane/.SelectStageActivity }
07-24 06:49:45.799: ERROR/dalvikvm-heap(669): 3456000-byte external allocation too large for this process.
07-24 06:49:45.799: ERROR/GraphicsJNI(669): VM won't let us allocate 3456000 bytes
07-24 06:49:45.810: DEBUG/AndroidRuntime(669): Shutting down VM
07-24 06:49:45.810: WARN/dalvikvm(669): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-24 06:49:45.869: ERROR/AndroidRuntime(669): FATAL EXCEPTION: main
07-24 06:49:45.869: ERROR/AndroidRuntime(669): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.FlightPlane/com.FlightPlane.SelectStageActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class <unknown>
07-24 06:49:45.869: ERROR/AndroidRuntime(669): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
이런
오류가뜨거든요??
제생각에는 메모리릭이 발생할 정도의 용량은 아니라서
그림파일 아니 프로젝트 전체크기를 해도 16메가가 넘지않거든요
무슨문제인지 제가 이번에 안드로이드는 처음접해서 너무 정신이없네요..ㅠㅠ
아니면 화면전환을 해주는 소스부분이 잘못된건가요??
public class MenuActivity extends Activity implements OnClickListener{
private static final String TAG = "MenuActivity";
private Pop pop;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
Log.d(TAG, "[onCreate] start");
//Get each button ID
ImageButton playGamebtn = (ImageButton)findViewById(R.id.PlayGameBtn);
ImageButton modifyOptionbtn = (ImageButton)findViewById(R.id.ModifyOptionBtn);
ImageButton showScorebtn = (ImageButton)findViewById(R.id.ShowScoresBtn);
ImageButton selectIdbtn = (ImageButton)findViewById(R.id.SelectIdBtn);
//Set ButtonListener
playGamebtn.setOnClickListener(this);
modifyOptionbtn.setOnClickListener(this);
showScorebtn.setOnClickListener(this);
selectIdbtn.setOnClickListener(this);
Log.d(TAG, "[onCreate] finished");
}
private void Show(View v){
pop = new Pop(v);
pop.show();
}
public void onClick(View v) {
switch(v.getId()){
case R.id.PlayGameBtn:
Intent play = new Intent(this, SelectStageActivity.class);
startActivity(play);
break;
case R.id.ModifyOptionBtn:
Intent modify = new Intent(this, OptionActivity.class);
startActivity(modify);
break;
case R.id.ShowScoresBtn:
Intent score = new Intent(this, ScoreActivity.class);
startActivity(score);
break;
case R.id.SelectIdBtn:
Show(v);
break;
}
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo){
super.onCreateContextMenu(menu, v, menuInfo);
if(v.getId() == R.id.SelectIdBtn){
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.layout.selectid, menu);
menu.setHeaderTitle("SelectID");
}
}
}
이소스가 메인 액티비티인데요 여기서 start버튼을 누를시에 저런 에러가뜨네요..
같은 소스로 간단한 레이아웃은 넘어가는데
레이아웃을 바꾼후에 저런 에러가뜨는이유는 뭐일까요??
제가 레이아웃을 absolute Layout을 사용하였는데 그것이 메모리를 많이 잡아먹는것인가요??
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/stagelayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/plane_bg"
>
<AbsoluteLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/stage_title"
>
<ImageView
android:id="@+id/stagetitle"
android:layout_width="273px"
android:layout_height="69px"
android:layout_x="269px"
android:layout_y="29px"
/>
</AbsoluteLayout>
<AbsoluteLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/stage1"
>
<ImageButton
android:id="@+id/selectstagebutton1"
android:layout_width="174px"
android:layout_height="311px"
android:layout_x="101px"
android:layout_y="128px"
android:background="#00000000"
/>
</AbsoluteLayout>
<AbsoluteLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/stage2_off"
>
<ImageButton
android:id="@+id/selectstagebutton2"
android:layout_width="173px"
android:layout_height="313px"
android:layout_x="316px"
android:layout_y="127px"
android:background="#00000000"
/>
</AbsoluteLayout>
<AbsoluteLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/stage3_off"
>
<ImageButton
android:id="@+id/selectstagebutton3"
android:layout_width="170px"
android:layout_height="311px"
android:layout_x="530px"
android:layout_y="128px"
android:background="#00000000"
/>
</AbsoluteLayout>
</RelativeLayout>
이것은 제가 한 넘어가야하는 layout인데요
png파일을 전체 레이아웃들로 붙여서 셀로판지처럼 마지막에 완성되게 만들었는데
제가 레이아웃을 잘못짠것인가요?
ㅠㅠㅠ 도와주세요 고수님들..ㅠㅠㅠ 소스만 갖다붙인거같아서 죄송합니당..ㅠㅠ




AbsoluteLayout 대신에 FrameLayout 이나 RelativeLayout을 사용하시길 권장합니다.
AbsoluteLayout은 없어질 예정입니다.