Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

add many MarkerOptions with differents drawable crash #9578

Closed
ghost opened this issue Jul 21, 2017 · 3 comments
Closed

add many MarkerOptions with differents drawable crash #9578

ghost opened this issue Jul 21, 2017 · 3 comments
Labels
Android Mapbox Maps SDK for Android

Comments

@ghost
Copy link

ghost commented Jul 21, 2017

Platform: ANDROID SDK 25 - NEXUS 6P ANDROID 7.1.2 ROM STOCK
Mapbox SDK version: com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.0@aar

public Boolean add_puntos()
{
    try {
        M_Propiedad consultas = new M_Propiedad(funciones);
        String sql_propiedades = consultas.sql_propiedades_inmuebles_residentes(
                null
                , where_tp_prop
                , where_status_inmueble
                , where_visita_inmueble
                , where_tp_residente
                , where_idioma_residente

        );
        Cursor c_propiedad = funciones._CRUD.SQL(sql_propiedades);
        int pin_actual;
        if (c_propiedad != null && c_propiedad.moveToFirst()) {
            while (!c_propiedad.isAfterLast()) {
                pin_actual = c_propiedad.getInt(c_propiedad.getColumnIndex(O_MyDBHandler.COLUMN_c_img));
                marcadores_permanentes.add(nuevo_pin(pin_actual, c_propiedad.getString(c_propiedad.getColumnIndex(O_MyDBHandler.COLUMN_c_desc)), c_propiedad.getString(c_propiedad.getColumnIndex(O_MyDBHandler.COLUMN_c_id)), new LatLng((c_propiedad.getDouble(c_propiedad.getColumnIndex(O_MyDBHandler.COLUMN_c_geo_lat))), (c_propiedad.getDouble(c_propiedad.getColumnIndex(O_MyDBHandler.COLUMN_c_geo_lon)))), puedo_mover_pin, true));
                c_propiedad.moveToNext();
            }
        }
        if (c_propiedad != null) {
            c_propiedad.close();
        }

        if(marcadores_permanentes != null && marcadores_permanentes.size() > 0)
        {
            mapView.addMarkers(marcadores_permanentes);
        }
      
        return true;
    }
    catch (Exception e)
    {
        return false;
    }
}

public MarkerOptions nuevo_pin(int indice_pin, String titulo, String id_propiedad, LatLng loc, Boolean puede_mover, Boolean desde_banco) {

/*
SOURCE INDEX OF DRAWABLE

@drawable/pin_amarillo_grande @drawable/pin_azul_grande @drawable/pin_naranjado_grande @drawable/pin_negro_grande @drawable/pin_purpura_grande @drawable/pin_rojo_grande @drawable/pin_verde_grande @drawable/casa_grande @drawable/edificio_grande @drawable/empresa_grande @drawable/otro_grande @drawable/terreno_grande @drawable/pin_rosa_grande @drawable/pin_marron_grande @drawable/transparente_grande

*/

    MarkerOptions marker = new MarkerOptions();
    try {
        JSONObject datos_extra = new JSONObject();
        datos_extra.put(O_Constantes.indice_pin, indice_pin);
        datos_extra.put(O_Constantes.id_propriedad, id_propiedad);
        marker.setPosition(new LatLng(loc.getLatitude(), loc.getLongitude()));
       iconFactory         = IconFactory.getInstance(this);
       pins                = getResources().obtainTypedArray(R.array.pins_markers);
        marker.setIcon(iconFactory.fromResource(pins.getResourceId(indice_pin,0)));
        marker.setTitle(titulo);
        marker.setSnippet(datos_extra.toString());
        return marker;
    } catch (Exception e) {
       
        return marker;
    }

}

error start*****

                                            --------- beginning of crash

07-21 10:54:45.660 15067-15067/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x8 in tid 15067 (psjw.territorio)

                                     [ 07-21 10:54:45.661   384:  384 W/         ]
                                     debuggerd: handling request: pid=15067 uid=10218 gid=10218 tid=15067

07-21 10:54:45.798 15249-15249/? A/DEBUG: pid: 15067, tid: 15067, name: psjw.territorio >>> com.mapsjw.territorio <<<
07-21 10:54:45.804 15249-15249/? A/DEBUG: #00 pc 00000000001df390 /data/app/com.mapsjw.territorio-1/lib/arm64/libmapbox-gl.so
07-21 10:54:45.804 15249-15249/? A/DEBUG: #1 pc 00000000001df274 /data/app/com.mapsjw.territorio-1/lib/arm64/libmapbox-gl.so
07-21 10:54:45.804 15249-15249/? A/DEBUG: #2 pc 00000000001df248 /data/app/com.mapsjw.territorio-1/lib/arm64/libmapbox-gl.so
07-21 10:54:45.804 15249-15249/? A/DEBUG: #3 pc 00000000001ccf0c /data/app/com.mapsjw.territorio-1/lib/arm64/libmapbox-gl.so
07-21 10:54:45.804 15249-15249/? A/DEBUG: #4 pc 00000000001cd3e4 /data/app/com.mapsjw.territorio-1/lib/arm64/libmapbox-gl.so
07-21 10:54:45.804 15249-15249/? A/DEBUG: #5 pc 0000000000126508 /data/app/com.mapsjw.territorio-1/lib/arm64/libmapbox-gl.so
07-21 10:54:45.804 15249-15249/? A/DEBUG: #6 pc 0000000000089ba8 /data/app/com.mapsjw.territorio-1/lib/arm64/libmapbox-gl.so
07-21 10:54:45.804 15249-15249/? A/DEBUG: #7 pc 0000000000095930 /data/app/com.mapsjw.territorio-1/lib/arm64/libmapbox-gl.so
07-21 10:54:45.804 15249-15249/? A/DEBUG: #8 pc 0000000000537eb0 /data/app/com.mapsjw.territorio-1/oat/arm64/base.odex (offset 0x505000)
07-21 10:54:47.763 924-15250/? W/ActivityManager: Force finishing activity com.mapsjw.territorio/.A_Mapa

                                              [ 07-21 10:54:47.776   384:  384 W/         ]
                                              debuggerd: resuming target 15067

07-21 10:54:47.838 924-30559/? I/WindowManager: WIN DEATH: Window{71dbb59 u0 com.mapsjw.territorio/com.mapsjw.territorio.A_Mapa}
07-21 10:54:47.839 924-2303/? I/ActivityManager: Process com.mapsjw.territorio (pid 15067) has died
07-21 10:54:47.839 924-2303/? W/ActivityManager: Scheduling restart of crashed service com.mapsjw.territorio/com.mapbox.services.android.telemetry.service.TelemetryService in 1000ms
07-21 10:54:47.851 924-3307/? W/InputDispatcher: channel '461165d com.mapsjw.territorio/com.mapsjw.territorio.A_Mapa (server)' ~ Consumer closed input channel or an error occurred. events=0x9
07-21 10:54:47.851 924-3307/? E/InputDispatcher: channel '461165d com.mapsjw.territorio/com.mapsjw.territorio.A_Mapa (server)' ~ Channel is unrecoverably broken and will be disposed!
07-21 10:54:47.858 924-6366/? I/WindowManager: WIN DEATH: Window{8829e8a u0 SurfaceView - com.mapsjw.territorio/com.mapsjw.territorio.A_Mapa}
07-21 10:54:47.875 924-26502/? I/WindowManager: WIN DEATH: Window{461165d u0 com.mapsjw.territorio/com.mapsjw.territorio.A_Mapa}
07-21 10:54:47.875 924-26502/? W/InputDispatcher: Attempted to unregister already unregistered input channel '461165d com.mapsjw.territorio/com.mapsjw.territorio.A_Mapa (server)'
07-21 10:54:54.867 924-15250/? W/ActivityManager: Ignoring remove of inactive process: ProcessRecord{6c23ee1 0:com.mapsjw.territorio/u0a218}
07-21 10:54:54.899 924-938/? W/ViewRootImpl[territorio]: Dropping event due to root view being removed: MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=324.0, y[0]=997.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x2, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=85888272, downTime=85888263, deviceId=7, source=0x1002 }

error finish****

@fabian-guerra fabian-guerra added the Android Mapbox Maps SDK for Android label Jul 21, 2017
@ghost
Copy link
Author

ghost commented Jul 21, 2017

i found a solution: use addMarkerViews. is very much slow, but works

@tobrun
Copy link
Member

tobrun commented Jul 24, 2017

Your issue is related to constantly creating new Icon through marker.setIcon(iconFactory.fromResource(pins.getResourceId(indice_pin,0)));. Move this out of your for loop and manage this more efficiently and that setup should work. Not actionable atm. closing.

@tobrun tobrun closed this as completed Jul 24, 2017
@ghost
Copy link
Author

ghost commented Jul 24, 2017

Hi tobrun,
How I can manage more efficiently?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

2 participants