2012-04-22 62 views
0

我的應用程序保持突然關閉,沒有任何通知時,當我從風景到肖像,反之亦然,我也得到同樣的錯誤,繼續發送從一項活動到另一項活動的價值。 下面是一些錯誤,我從logcat中得到:應用程序關閉時,繼續從景觀移動到肖像,並從一個活動發送價值到另一個活動

從保留日誌的移動距離保持在橫向和縱向

04-22 20:23:31.110: E/dalvikvm-heap(6275): 5891496-byte external allocation too large for this process. 
04-22 20:23:31.120: E/dalvikvm(6275): Out of memory: Heap Size=5639KB, Allocated=3205KB, Bitmap Size=22062KB, Limit=32768KB 
04-22 20:23:31.120: E/dalvikvm(6275): Trim info: Footprint=5639KB, Allowed Footprint=5639KB, Trimmed=496KB 
04-22 20:23:31.120: E/GraphicsJNI(6275): VM won't let us allocate 5891496 bytes 

日誌從一個活動發送值到另一個活動

04-22 21:57:04.497: D/dalvikvm(9570): GC_EXTERNAL_ALLOC freed 19K, 47% free 2901K/5379K, external 1151K/1663K, paused 24ms 
04-22 21:57:04.647: D/dalvikvm(9570): GC_EXTERNAL_ALLOC freed 85K, 45% free 2960K/5379K, external 2320K/2875K, paused 24ms 
04-22 21:57:04.807: D/dalvikvm(9570): GC_EXTERNAL_ALLOC freed 2K, 45% free 2960K/5379K, external 8073K/10082K, paused 23ms 
04-22 21:57:04.927: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected] 
04-22 21:57:04.937: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected] 
04-22 21:57:04.937: D/WindowManagerImpl(9570): addView, new view, mViews[1]: [email protected] 
04-22 21:57:05.227: D/WindowManagerImpl(9570): finishRemoveViewLocked, mViews[0]: [email protected] 
04-22 21:57:06.158: D/View(9570): onTouchEvent: viewFlags: 0x18004081 
04-22 21:57:06.158: D/View(9570): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false 
04-22 21:57:06.238: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected] 
04-22 21:57:06.529: D/View(9570): onTouchEvent: viewFlags: 0x18004081 
04-22 21:57:06.529: D/View(9570): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false 
04-22 21:57:06.549: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected] 
04-22 21:57:07.019: D/dalvikvm(9570): GC_EXTERNAL_ALLOC freed 83K, 45% free 3035K/5447K, external 13863K/15875K, paused 25ms 
04-22 21:57:07.129: D/View(9570): onTouchEvent: viewFlags: 0x18004081 
04-22 21:57:07.129: D/View(9570): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false 
04-22 21:57:07.149: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected] 
04-22 21:57:07.289: D/View(9570): onTouchEvent: viewFlags: 0x18004081 
04-22 21:57:07.289: D/View(9570): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false 
04-22 21:57:07.369: D/dalvikvm(9570): GC_EXTERNAL_ALLOC freed 34K, 44% free 3058K/5447K, external 12711K/14759K, paused 26ms 
04-22 21:57:07.600: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected]8 
04-22 21:57:08.050: D/View(9570): onTouchEvent: viewFlags: 0x18004081 
04-22 21:57:08.050: D/View(9570): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false 
04-22 21:57:08.050: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected] 
04-22 21:57:08.421: D/View(9570): onTouchEvent: viewFlags: 0x18004081 
04-22 21:57:08.421: D/View(9570): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false 
04-22 21:57:08.431: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected] 
04-22 21:57:08.771: D/View(9570): onTouchEvent: viewFlags: 0x18004081 
04-22 21:57:08.771: D/View(9570): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false 
04-22 21:57:08.841: D/dalvikvm(9570): GC_EXTERNAL_ALLOC freed 55K, 44% free 3092K/5447K, external 18465K/18465K, paused 24ms 
04-22 21:57:09.091: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected] 
04-22 21:57:09.201: D/dalvikvm(9570): GC_EXTERNAL_ALLOC freed 9K, 44% free 3093K/5447K, external 24218K/24218K, paused 24ms 
04-22 21:57:09.321: D/dalvikvm(9570): GC_FOR_MALLOC freed <1K, 44% free 3092K/5447K, external 24218K/24218K, paused 17ms 
04-22 21:57:09.341: D/View(9570): onTouchEvent: viewFlags: 0x18004081 
04-22 21:57:09.341: D/View(9570): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false 
04-22 21:57:09.351: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected] 
04-22 21:57:09.542: D/View(9570): onTouchEvent: viewFlags: 0x18004081 
04-22 21:57:09.542: D/View(9570): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false 
04-22 21:57:09.542: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected] 
04-22 21:57:09.692: D/dalvikvm(9570): GC_EXTERNAL_ALLOC freed 70K, 44% free 3098K/5511K, external 24218K/24218K, paused 30ms 
04-22 21:57:09.812: D/dalvikvm(9570): GC_FOR_MALLOC freed 5K, 44% free 3093K/5511K, external 24218K/24218K, paused 17ms 
04-22 21:57:09.872: D/View(9570): onTouchEvent: viewFlags: 0x18004081 
04-22 21:57:09.872: D/View(9570): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false 
04-22 21:57:09.882: D/ATRecorder(9570): com.htc.autotest.dlib.RecordEngine in loader [email protected] 
04-22 21:57:10.312: D/View(9570): onTouchEvent: viewFlags: 0x18004081 
04-22 21:57:10.312: D/View(9570): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false 
04-22 21:57:10.412: D/dalvikvm(9570): GC_EXTERNAL_ALLOC freed 51K, 44% free 3099K/5511K, external 24218K/24218K, paused 24ms 
04-22 21:57:10.533: D/dalvikvm(9570): GC_FOR_MALLOC freed 3K, 44% free 3096K/5511K, external 24218K/24218K, paused 17ms 
04-22 21:57:10.613: D/dalvikvm(9570): GC_EXTERNAL_ALLOC freed <1K, 44% free 3097K/5511K, external 24218K/24218K, paused 28ms 
04-22 21:57:10.613: E/dalvikvm-heap(9570): 5891496-byte external allocation too large for this process. 
04-22 21:57:10.613: E/dalvikvm(9570): Out of memory: Heap Size=5511KB, Allocated=3097KB, Bitmap Size=24218KB, Limit=32768KB 
04-22 21:57:10.613: E/dalvikvm(9570): Trim info: Footprint=5511KB, Allowed Footprint=5511KB, Trimmed=448KB 
04-22 21:57:10.613: E/GraphicsJNI(9570): VM won't let us allocate 5891496 bytes 

這裏是我的代碼,當我發送值:result.java

public class result extends Activity { 
     public static String destination = ""; 

search.java

public void setButtonClickListener() { 
    Button searchButton = (Button)findViewById(R.id.buttonSearch); 
    searchButton.setOnClickListener(new View.OnClickListener() { 
     public void onClick(View v) { 
       result.destination = textView.getText().toString(); 
       TabHost tabHost = (TabHost) getParent().findViewById(android.R.id.tabhost); 
       tabHost.setCurrentTab(0); 
     } 
     }); 
} 

我的應用程序是使用標籤視圖中有三個不同的活動。我也使用.jpg作爲背景,並且在標籤中有一個圖像視圖。我讀過External allocation too large for this process in Android的回答,但我並沒有明白這一點。有人能以更簡單的方式告訴我如何處理它嗎?或者我應該在哪裏尋找答案?

對於發送值的內存問題,我認爲可能的問題是在tab之間移動,因爲當我在tab之間移動時,同樣的錯誤也出現了。

+0

請粘貼完整的日誌錯誤 – 2012-04-22 13:38:13

+0

我已經貼我的完整記錄。請看看它。 – Thomas 2012-04-22 14:00:31

回答

0

添加這些行活動在manifeast文件:::

<activity 
     android:configChanges="keyboardHidden|orientation" 
     android:name=".Activity"> 
+0

你有試過嗎? – 2012-04-22 12:42:59

+0

感謝您的回答,它解決了我的問題。對不起,我不能投票,因爲我沒有足夠的聲譽。 – Thomas 2012-04-22 12:46:39

+0

完成。順便說一句,我只是發現同樣的錯誤,當我嘗試重複發送一個值到另一個活動。我嘗試使用activity1.string1 = textView.getText()。toString();從activity2發送字符串到activity1。你能再幫我一次嗎?非常感謝。或者我應該問新的問題? – Thomas 2012-04-22 12:59:38

相關問題