2013-04-14 110 views
0

actionBar.setHome函數調用Application Home Activity。當它調用時,就像重新打開應用程序一樣。我的意思是我必須等待加載首頁活動。我認爲可能有一種方法不能重新加載,重新加載首頁活動,但首頁活動隱藏或存儲家庭活動的內存。首頁活動有字體嵌入,兩個標籤和按鈕。當Home Activity中的按鈕出現時,活動會轉到另一個activityBar.setHome函數重定向Home Activity,就像重新加載它一樣。
兒童活動代碼:從另一個活動調用首頁活動後如何從兒童活動加載更快的父活動?

public void onCreate(Bundle savedInstanceState) { 
....................... 
....................... 
actionBar.setHomeAction(new IntentAction(this, createIntent(this), 
      R.drawable.ic_title_home_default)); 
    } 
    //calling Parent Activity 
    private static Intent createIntent(Context context) { 
    Intent i = new Intent(context, CustomTabActivity.class); 
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
    return i; 
    } 



logcat的:

04-14 22:20:49.788: I/ActivityManager(245): Starting: Intent { flg=0x4000000 cmp=com.joshclemm.android.tabswithactivity/.CustomTabActivity } from pid 30761 
04-14 22:20:49.838: D/szipinf(30761): Initializing inflate state 
04-14 22:20:49.898: D/szipinf(30761): Initializing inflate state 
04-14 22:20:49.908: D/szipinf(30761): Initializing inflate state 
04-14 22:20:49.918: D/szipinf(30761): Initializing inflate state 
04-14 22:20:49.928: D/szipinf(30761): Initializing inflate state 
04-14 22:20:49.938: D/szipinf(30761): Initializing inflate state 
04-14 22:20:49.958: D/szipinf(30761): Initializing inflate state 
04-14 22:20:49.968: D/szipinf(30761): Initializing inflate state 
04-14 22:20:49.978: D/szipinf(30761): Initializing inflate state 
04-14 22:20:49.988: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.008: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.018: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.028: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.038: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.048: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.068: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.078: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.088: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.098: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.118: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.128: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.138: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.148: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.158: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.178: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.188: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.198: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.208: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.228: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.238: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.248: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.258: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.268: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.288: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.298: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.308: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.318: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.338: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.348: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.568: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.648: D/szipinf(30761): Initializing inflate state 
04-14 22:20:50.678: D/skia(30761): purging 191K from font cache [28 entries] 
04-14 22:20:50.718: D/skia(30761): purging 192K from font cache [27 entries] 
04-14 22:20:50.978: I/ActivityManager(245): Displayed com.joshclemm.android.tabswithactivity/.CustomTabActivity: +1s172ms 

需要在首頁的活動講座什麼額外的代碼>的OnCreate ()或任何方法不嘗試重新加載,如果一旦已經加載? 或者如果函數調用另一個活動時如何讓Home Activity隱藏?

回答

0

狗屎我自己解決我的問題。無論如何,感謝所有這些問題的觀衆。

public void onCreate(Bundle savedInstanceState) { 
....................... 
....................... 
actionBar.setHomeAction(new IntentAction(this, createIntent(this), 
      R.drawable.ic_title_home_default)); 
    } 
    //calling Parent Activity 
    private static Intent createIntent(Context context) { 
    Intent i = new Intent(context, CustomTabActivity.class); 
    i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); 
    return i; 
    } 

變化是:FLAG_ACTIVITY_REORDER_TO_FRONT

相關問題