我的內存泄漏是由AudioManager引起的。所以我註釋掉這一行我的代碼,看看是否能解決我的問題:(AudioManager)getSystemService(Context.AUDIO_SERVICE)導致內存泄漏
public class FireRoomActivity extends Activity {
AudioManager am;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
}
}
而且它沒有解決這個問題,我沒有內存泄露了。那是因爲Context.AUDIO_SERVICE嗎?如果是,那我該如何更換它?
如果它的事項,我有我的活動這裏面非靜態類,未在其他地方使用外
class GestureListener extends GestureDetector.SimpleOnGestureListener {
RelativeLayout parentLayout;
public void setLayout(RelativeLayout layout){
parentLayout = layout; }
@Override
public boolean onDown(MotionEvent e) {
return true;
}
// event when double tap occurs
@Override
public boolean onDoubleTap(MotionEvent e) {
makeArrowsVisible();
parentLayout.findViewById(R.id.cabinet_zoomed).setVisibility(View.INVISIBLE);
Button key = (Button)parentLayout.findViewById(R.id.key);
if(key!=null){
key.setVisibility(View.INVISIBLE);}
return true;
}
編輯: 截圖堆轉儲
後的實際證據,導致你相信你有內存泄漏。 –
謝謝。編輯。 – Nazerke