问题
I need to remove Google map fragment on Activity onPause event and add it back onResume event. How can i do this ?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mapContainer"
tools:context=".MainActivity" >
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
Accordingly to this Back button very slow
Need it for Android Performance Issue- TabHost - Timer - SetCurrentTab() - Google Maps Api V2
Edit :
Actually I did it. But still got a delay problem. How can i stop/close intents at back stack?
Edit :
Also i'm now trying to remove and add back fragment please see this -> https://stackoverflow.com/questions/16275349/android-add-supportfragment-and-get-it-back-from-its-tag-null
回答1:
I've just removed tabview. It's really fast now.If you are worrying about performance in a situation like mine, I suggest you to remove tabhost and just use new Intent().
来源:https://stackoverflow.com/questions/16263408/android-remove-google-maps-fragment-onpause-and-add-back-onresume