我有一个包含 mapfragment 和 rss 提要的主屏幕,它们在启动时加载。我还有一些包含更大的磁碎片的活动。
我的问题是,当我在它们重新启动的活动之间移动时,我希望它们在我回到该活动时保持加载状态。使用户免于重新下载数据。
任何反馈表示赞赏
谢谢
这是我一直在使用的;
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Intent MapActivity = new Intent(getApplicationContext(),HomeActivity.class);
startActivity(MapActivity);
}
});
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
new MyTask().execute();
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
map.moveCamera(CameraUpdateFactory.newLatLngZoom(-, 15000));
map.animateCamera(CameraUpdateFactory.zoomTo(7), 2000, null);
map.setMyLocationEnabled(true);
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
map.getUiSettings().setZoomControlsEnabled(true);
map.getUiSettings().setMyLocationButtonEnabled(true);
map.setTrafficEnabled(true);
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Location lastLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
// Get the location manager
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
provider = locationManager.getBestProvider(criteria, false);
Location location = locationManager.getLastKnownLocation(provider);
}
我不使用 OnResume,这是我的问题吗?