제가 아직 진도가 객체지향 을 배우고 있는 단계인데..
안드로이드 어플을 만들어 보던중 oom이 터졌습니다.
다쓴 메모리가 초기화 되지 않아서 이러는 것 같은데..
null 값을 저런 식 으로 지정해주는거..... 아니죠??;;;;
아닌것 뻔히 아는데, 제가 지금 지식이 없는 상황이라.. 사용 방법을 모르겠습니다.
도와주십시요 ..
public class HR3 extends Activity implements OnClickListener {
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(Window.FEATURE_NO_TITLE, Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.hr3);
Button btn9 = (Button)findViewById(R.id.btn9);
btn9.setOnClickListener(this);
Button btn10 = (Button)findViewById(R.id.btn10);
btn10.setOnClickListener(this);
}
public void onClick(View v){
if(v.getId()==R.id.btn9){
Intent intent=new Intent(this,HR4.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY|Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
finish();
}
else if(v.getId()==R.id.btn10){
Intent intent=new Intent(this,HR2.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY|Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
finish();
}
public void onPause(View hr3) {
if (hr3 == null)
return;
hr3.setBackgroundDrawable(null);
}
-----------------xml
<?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" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:orientation="vertical">
<ImageView
android:id="@+id/image1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/b51"
android:adjustViewBounds="true" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:orientation="horizontal">
<Button
android:id="@+id/btn2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/b12btn"
android:adjustViewBounds="true"
android:layout_weight="1" />
<Button
android:id="@+id/btn1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/nextbtn"
android:adjustViewBounds="true"
android:layout_weight="1" />
</LinearLayout>
<ImageView
android:id="@+id/image3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:src="@drawable/b54" />
</LinearLayout>
</ScrollView>




제 추축이지만 imageView에 엄청나게 대빵큰 이미지를 때려박으신건 아니신지? 그거 아니고서야 OOM이 일어날일이 읍을듯요