Android - Remove Google Maps Fragment onPause and add back onResume

ε祈祈猫儿з 提交于 2019-12-02 09:33:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!