我对我的申请感到困惑不解。 我相当肯定地把记忆泄露到某个地方,我认为我已经把它缩小到某种活动上,并且认为这种泄漏与AdMob有关。
说明 我所看到的是,如果我提出自己的建议,第一项活动涉及大约3Mb(显示形象)。 第二项活动装满后,第一只草原被销毁,总肥皂使用量增至7.8Mb。 一旦AdMob ad在第二次活动中装满,肥皂的大小就达到12.5兆瓦。
如果我回头来从事第一项活动,那么,第2项活动叫
令我感到困惑的是,如果我活着,再次开始第二次活动,那么我回头和第四时,肥皂的面积只能增加500千卡。 如同在第二次活动中,有些事情正在活下来并重新使用,尽管这些活动已经销毁。
我在这里简化了我的法典,看看一个人是否能够告诉我我我我什么是错的。 我也利用MAAT对垃圾堆放档案进行了研究,但我对我看什么和没有发现多少用途感到不满意。
<>My first (default) activity
public class FirstActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setContentView(R.layout.main);
}
public void startSelectionPage(View v){
Intent intent = new Intent(FirstActivity.this, ImageSelectActivity.class);
startActivity(intent);
}
}
<>strong>main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/startpage" >
<ImageButton
android:id="@+id/pb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/playbutton"
android:onClick="startSelectionPage"
/>
</RelativeLayout>
<>亮度>
public class ImageSelectActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setContentView(R.layout.selectionpage);
((Gallery) findViewById(R.id.gallery))
.setAdapter(new ImageAdapter(this.getApplicationContext(), 150));
}
@Override
public void onDestroy() {
AdView ad = (AdView) findViewById(R.id.adView);
ad.destroy();
super.onDestroy();
}
}
class ImageAdapter extends BaseAdapter {
private Context myContext;
private int imageBackground;
private int galleryHeight;
private int[] myImageIds = {
R.drawable.canyonthumb,
R.drawable.yosemitethumb,
R.drawable.flowerthumb,
R.drawable.squirrelthumb
};
public ImageAdapter(Context c, int galleryHeight) {
this.myContext = c;
TypedArray ta = c.obtainStyledAttributes(R.styleable.GalleryTheme);
imageBackground = ta.getResourceId(R.styleable.GalleryTheme_android_galleryItemBackground, 1);
ta.recycle();
this.galleryHeight = galleryHeight;
}
public int getCount() { return this.myImageIds.length; }
public Object getItem(int position) { return position; }
public long getItemId(int position) { return position; }
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView = new ImageView(myContext);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setLayoutParams(new Gallery.LayoutParams(galleryHeight,galleryHeight));
imageView.setBackgroundResource(imageBackground);
imageView.setImageResource(this.myImageIds[position]);
return imageView;
}
}
selectionpage.xml
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/chooseanimage"/>
<RelativeLayout
android:id="@+id/rlayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="60dp"
ads:adUnitId="----"
ads:adSize="IAB_BANNER"
ads:testDevices="TEST_EMULATOR,---"
ads:loadAdOnCreate="true"
/>
<Gallery
android:id="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/imageView1"
android:layout_above="@+id/adView"
/>
</RelativeLayout>
</LinearLayout>