0
我在我的applcation中實現了Google Maps Android API v2。Launch to MapFragment /從MapFragment按下後退按鈕導致長時間黑屏
目前,我有它由不同片段的活動:
public class MyTravelogueActivity extends SherlockFragmentActivity {
int travelogueID;
String placeID;
boolean isTravelogue;
Bundle b;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String checkStatus = "";
b = getIntent().getExtras();
if (savedInstanceState != null) {
getSupportFragmentManager().popBackStack(null, getSupportFragmentManager().POP_BACK_STACK_INCLUSIVE);
checkStatus = savedInstanceState.getString("statusCheck");
b = savedInstanceState.getBundle("bundle");
}
else {
checkStatus = (String) b.get("status");
}
setContentView(R.layout.activity_frag);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
/*
codes to add Fragment to ft
*/
ft.commit();
}
}
因此,這要求我MapFragment類...
public class TravelogueSEOPageFragment extends SherlockFragment {
//............. codes
public void Map(View view){
if(hasConnection() == true){
Bundle b = new Bundle();
b.putInt("id", travelogueID);
b.putString("currentlayoutview", currentview);
FragmentTransaction ft = getSherlockActivity().getSupportFragmentManager().beginTransaction();
TOnlineMapViewFragment mapfrag = TOnlineMapViewFragment.newInstance(b, place_list);
ft.replace(R.id.container, mapfrag).addToBackStack(null).commit();
}
}
}
我的問題是,爲什麼它上加載谷歌地圖,有一段時間的黑屏顯示?完成查看地圖後,單擊後退按鈕時,黑色屏幕顯示的時間會更長。
我不知道我應該粘貼哪些其他代碼來說明這個問題,所以請讓我知道如果我缺少任何代碼,以便更好地允許我要求解決這種現象。