{"action":"closed","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/11121","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-native","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/11121/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/11121/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/11121/events","html_url":"https://github.com/mapbox/mapbox-gl-native/issues/11121","id":294686207,"number":11121,"title":"MapView in fragment not working and the app freezes after calling recreate() in the host activity","user":{"login":"minthura","id":6892286,"avatar_url":"https://avatars2.githubusercontent.com/u/6892286?v=4","gravatar_id":"","url":"https://api.github.com/users/minthura","html_url":"https://github.com/minthura","followers_url":"https://api.github.com/users/minthura/followers","following_url":"https://api.github.com/users/minthura/following{/other_user}","gists_url":"https://api.github.com/users/minthura/gists{/gist_id}","starred_url":"https://api.github.com/users/minthura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minthura/subscriptions","organizations_url":"https://api.github.com/users/minthura/orgs","repos_url":"https://api.github.com/users/minthura/repos","events_url":"https://api.github.com/users/minthura/events{/privacy}","received_events_url":"https://api.github.com/users/minthura/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-06T09:25:23Z","updated_at":"2018-02-06T09:27:48Z","closed_at":"2018-02-06T09:27:48Z","author_association":"NONE","body":"**Platform:**\r\nAndroid\r\n\r\n**Mapbox SDK version:**\r\nmapbox-android-sdk:5.4.0\r\n\r\n### Steps to trigger behavior\r\n\r\n 1. I use MapView in a fragment. All lifecycle functions are also implemented properly.\r\n 2. I call recreate() function in the host activity for language change purpose.\r\n 3. The app freezes and the MapView goes black.\r\n\r\nI've provided some codes for your reference.\r\nMapFragment.java\r\n```java\r\npublic class MapFragment extends Fragment {\r\n\r\n    private MapView mapView;\r\n    private HomeListener mListener = null;\r\n\r\n    public MapFragment() {\r\n        // Required empty public constructor\r\n    }\r\n\r\n    public static MapFragment newInstance() {\r\n        MapFragment fragment = new MapFragment();\r\n        return fragment;\r\n    }\r\n\r\n    @Override\r\n    public void onAttach(Context context) {\r\n        super.onAttach(context);\r\n        if (context instanceof HomeListener) {\r\n            mListener = (HomeListener) context;\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n                             Bundle savedInstanceState) {\r\n        // Inflate the layout for this fragment\r\n        View view = inflater.inflate(R.layout.fragment_map, container, false);\r\n        mapView = view.findViewById(R.id.mapView);\r\n        view.findViewById(R.id.btnChangeLanguage).setOnClickListener(new View.OnClickListener() {\r\n            @Override\r\n            public void onClick(View view) {\r\n                mListener.onLanguageChange(null);\r\n            }\r\n        });\r\n        return view;\r\n    }\r\n\r\n    @Override\r\n    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\r\n        super.onViewCreated(view, savedInstanceState);\r\n        mapView.onCreate(savedInstanceState);\r\n    }\r\n\r\n    @Override\r\n    public void onStart() {\r\n        super.onStart();\r\n        mapView.onStart();\r\n    }\r\n\r\n    @Override\r\n    public void onResume() {\r\n        super.onResume();\r\n        mapView.onResume();\r\n    }\r\n\r\n    @Override\r\n    public void onPause() {\r\n        super.onPause();\r\n        mapView.onPause();\r\n    }\r\n\r\n    @Override\r\n    public void onStop() {\r\n        super.onStop();\r\n        mapView.onStop();\r\n    }\r\n\r\n    @Override\r\n    public void onLowMemory() {\r\n        super.onLowMemory();\r\n        mapView.onLowMemory();\r\n    }\r\n\r\n    @Override\r\n    public void onDestroy() {\r\n        super.onDestroy();\r\n        mapView.onDestroy();\r\n    }\r\n\r\n    @Override\r\n    public void onSaveInstanceState(Bundle outState) {\r\n        super.onSaveInstanceState(outState);\r\n        mapView.onSaveInstanceState(outState);\r\n    }\r\n\r\n}\r\n```\r\n\r\nMainActivity.java\r\n```java\r\npublic class MainActivity extends AppCompatActivity implements HomeListener {\r\n\r\n    @Override\r\n    protected void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        Mapbox.getInstance(this, \"my-key\");\r\n        setContentView(R.layout.activity_main);\r\n        getSupportFragmentManager().beginTransaction().replace(R.id.home_container, MapFragment.newInstance()).commit();\r\n    }\r\n\r\n    @Override\r\n    public void onLanguageChange(View view) {\r\n        recreate();\r\n    }\r\n}\r\n```\r\n\r\nScreenshot\r\n![device-2018-02-06-154914](https://user-images.githubusercontent.com/6892286/35851132-672d883e-0b55-11e8-81d3-963050e5493b.png)\r\n"}}
{"actor":{"display_login":"tobrun"}}