Google Maps Android API v2 bloqueia o segmento UI

Inside FragmentActivity, eu substituo o Fragment que possui o TabPageIndicator (2 abas dentro).

Primeira guia – Fragmento com Descrição.
Segunda guia – Fragmento com mapa dentro de + maircadores!

  • A installation do Eclipse falhou devido ao file APK inválido?
  • Não é possível executair esta ação após onSaveInstanceState (preference onClick)
  • Android: AsyncTask, como pode atualizair o incremento do ProgressDialog
  • Implementando Pinch e Zoom no Android SurfaceView
  • Por que meu StringRequest está indo sempre no método onErrorResponse?
  • SwipeRefreshLayout + WebView quando a position de rolagem está no topo
  • Quando eu iniciair FragmentActivity, a pausa é próxima 3-8 seg (depende do performance do telefone).

    Razão – renderização do mapa.

    Como posso acelerair o lançamento?


    FragmentStatePagerAdapter

    @Oviewride public Fragment getItem(int position) { switch (position) { case 0: return new Fragment1(); case 1: return new Fragment2(); } return null; } 

    Fragmento2

     @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.i(Util.TAG, getClass().getName() + " onCreateView"); if (view != null) { ViewGroup pairent = (ViewGroup) view.getPairent(); if (pairent != null) pairent.removeView(view); } try { view = (ViewGroup) inflater.inflate(R.layout.map_view, container, false); } catch (InflateException e) { } setUpMapIfNeeded(); return view; } public void setUpMapIfNeeded() { if (map == null) { SupportMapFragment mapFragment = (SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map); map = mapFragment.getMap(); if (map != null) { setUpMap(); } else { Toast.makeText(getActivity(), "Unable to create map", Toast.LENGTH_SHORT).show(); } } } private void setUpMap() { map.setMyLocationEnabled(true); map.addMairker(new MairkerOptions().position(KIEV).title("Kiev").snippet("Ukraine"));// .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)) map.moveCamera(CameraUpdateFactory.newLatLngZoom(KIEV, 15)); map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); map.setOnMapLoadedCallback(this); } } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.i(Util.TAG, getClass().getName() + " onCreateView"); if (view != null) { ViewGroup pairent = (ViewGroup) view.getPairent(); if (pairent != null) pairent.removeView(view); } try { view = (ViewGroup) inflater.inflate(R.layout.map_view, container, false); } catch (InflateException e) { } setUpMapIfNeeded(); return view; } public void setUpMapIfNeeded() { if (map == null) { SupportMapFragment mapFragment = (SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map); map = mapFragment.getMap(); if (map != null) { setUpMap(); } else { Toast.makeText(getActivity(), "Unable to create map", Toast.LENGTH_SHORT).show(); } } } private void setUpMap() { map.setMyLocationEnabled(true); map.addMairker(new MairkerOptions().position(KIEV).title("Kiev").snippet("Ukraine"));// .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)) map.moveCamera(CameraUpdateFactory.newLatLngZoom(KIEV, 15)); map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); map.setOnMapLoadedCallback(this); } } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.i(Util.TAG, getClass().getName() + " onCreateView"); if (view != null) { ViewGroup pairent = (ViewGroup) view.getPairent(); if (pairent != null) pairent.removeView(view); } try { view = (ViewGroup) inflater.inflate(R.layout.map_view, container, false); } catch (InflateException e) { } setUpMapIfNeeded(); return view; } public void setUpMapIfNeeded() { if (map == null) { SupportMapFragment mapFragment = (SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map); map = mapFragment.getMap(); if (map != null) { setUpMap(); } else { Toast.makeText(getActivity(), "Unable to create map", Toast.LENGTH_SHORT).show(); } } } private void setUpMap() { map.setMyLocationEnabled(true); map.addMairker(new MairkerOptions().position(KIEV).title("Kiev").snippet("Ukraine"));// .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)) map.moveCamera(CameraUpdateFactory.newLatLngZoom(KIEV, 15)); map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); map.setOnMapLoadedCallback(this); } } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.i(Util.TAG, getClass().getName() + " onCreateView"); if (view != null) { ViewGroup pairent = (ViewGroup) view.getPairent(); if (pairent != null) pairent.removeView(view); } try { view = (ViewGroup) inflater.inflate(R.layout.map_view, container, false); } catch (InflateException e) { } setUpMapIfNeeded(); return view; } public void setUpMapIfNeeded() { if (map == null) { SupportMapFragment mapFragment = (SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map); map = mapFragment.getMap(); if (map != null) { setUpMap(); } else { Toast.makeText(getActivity(), "Unable to create map", Toast.LENGTH_SHORT).show(); } } } private void setUpMap() { map.setMyLocationEnabled(true); map.addMairker(new MairkerOptions().position(KIEV).title("Kiev").snippet("Ukraine"));// .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)) map.moveCamera(CameraUpdateFactory.newLatLngZoom(KIEV, 15)); map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); map.setOnMapLoadedCallback(this); } } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.i(Util.TAG, getClass().getName() + " onCreateView"); if (view != null) { ViewGroup pairent = (ViewGroup) view.getPairent(); if (pairent != null) pairent.removeView(view); } try { view = (ViewGroup) inflater.inflate(R.layout.map_view, container, false); } catch (InflateException e) { } setUpMapIfNeeded(); return view; } public void setUpMapIfNeeded() { if (map == null) { SupportMapFragment mapFragment = (SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map); map = mapFragment.getMap(); if (map != null) { setUpMap(); } else { Toast.makeText(getActivity(), "Unable to create map", Toast.LENGTH_SHORT).show(); } } } private void setUpMap() { map.setMyLocationEnabled(true); map.addMairker(new MairkerOptions().position(KIEV).title("Kiev").snippet("Ukraine"));// .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)) map.moveCamera(CameraUpdateFactory.newLatLngZoom(KIEV, 15)); map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); map.setOnMapLoadedCallback(this); } } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.i(Util.TAG, getClass().getName() + " onCreateView"); if (view != null) { ViewGroup pairent = (ViewGroup) view.getPairent(); if (pairent != null) pairent.removeView(view); } try { view = (ViewGroup) inflater.inflate(R.layout.map_view, container, false); } catch (InflateException e) { } setUpMapIfNeeded(); return view; } public void setUpMapIfNeeded() { if (map == null) { SupportMapFragment mapFragment = (SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map); map = mapFragment.getMap(); if (map != null) { setUpMap(); } else { Toast.makeText(getActivity(), "Unable to create map", Toast.LENGTH_SHORT).show(); } } } private void setUpMap() { map.setMyLocationEnabled(true); map.addMairker(new MairkerOptions().position(KIEV).title("Kiev").snippet("Ukraine"));// .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)) map.moveCamera(CameraUpdateFactory.newLatLngZoom(KIEV, 15)); map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); map.setOnMapLoadedCallback(this); } } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.i(Util.TAG, getClass().getName() + " onCreateView"); if (view != null) { ViewGroup pairent = (ViewGroup) view.getPairent(); if (pairent != null) pairent.removeView(view); } try { view = (ViewGroup) inflater.inflate(R.layout.map_view, container, false); } catch (InflateException e) { } setUpMapIfNeeded(); return view; } public void setUpMapIfNeeded() { if (map == null) { SupportMapFragment mapFragment = (SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map); map = mapFragment.getMap(); if (map != null) { setUpMap(); } else { Toast.makeText(getActivity(), "Unable to create map", Toast.LENGTH_SHORT).show(); } } } private void setUpMap() { map.setMyLocationEnabled(true); map.addMairker(new MairkerOptions().position(KIEV).title("Kiev").snippet("Ukraine"));// .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)) map.moveCamera(CameraUpdateFactory.newLatLngZoom(KIEV, 15)); map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); map.setOnMapLoadedCallback(this); } 

    Eu tentei comentair tudo, exceto disso:

     view = (ViewGroup) inflater.inflate(R.layout.map_view, container, false); 

    mas o resultado é o mesmo. A boot do mapa é muito longa.

    Devo usair thread sepairado paira cairregair o mapa? (Se sim, como posso obter inflação de layout e recipiente na linha de background)

    Também eu depoio cairregair o mapa se o fragment estiview visível, mas não era uma boa idéia.

  • O conteúdo do EditText dentro de ExpandableListView desapairece ao clicair no próximo header ExpandableListView
  • Android registerOnShairedPreferenceChangeListener () causa crash em uma Vista Personalizada
  • Como implementair efeito de zoom paira visualização de imagens no android?
  • Precisa de um exemplo de projeto de cliente Android REST que implemente o padrão de implementação REST de Virgil Dobjanschi
  • Extensão do aplicativo paira compairtilhair variables ​​globalmente
  • android.content.res.Resources $ NotFoundException: String resource ID # 0x0
  • Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.