IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Android Discussion :

Erreur "java.lang.IndexOutOfBoundsException"


Sujet :

Android

  1. #1
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    36
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 36
    Points : 21
    Points
    21
    Par défaut Erreur "java.lang.IndexOutOfBoundsException"
    Bonjour
    J'essaye actuellement de coder une application permettant d'afficher des points sur une carte Osm en appuyant sur un bouton.
    Pour ce faire je code le listener du bouton de la manière suivante
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    overlay.add(new OverlayItem("New Overlay", "Overlay Description", gPt));
                    ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getApplicationContext());
     
                    myLocationOverlay = new ItemizedIconOverlay<OverlayItem>(overlay,getResources().getDrawable(R.drawable.rtraction2), null, resourceProxy);
                    mMapView.getOverlays().add(myLocationOverlayr);
    Sachant qu'overlay est une Arraylist<OverlayItem>
    Cela marche très bien lorsque j'appuie sur le bouton calmement mais lorsque je le spam j'obtiens l'erreur suivante java.lang.IndexOutOfBoundsException de manière aléatoire.
    Normalement l'utilisateur n'est pas censé spamer le bouton mais j'aimerais quand même prévenir ce problème.
    Merci d'avance

  2. #2
    Expert confirmé
    Avatar de Hephaistos007
    Profil pro
    Enseignant Chercheur
    Inscrit en
    Décembre 2004
    Messages
    2 493
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Enseignant Chercheur
    Secteur : Enseignement

    Informations forums :
    Inscription : Décembre 2004
    Messages : 2 493
    Points : 4 166
    Points
    4 166
    Par défaut
    Il faudrait la StackTrace pour être sûr que l'erreur vient de cet ArrayList; j'en vois d'autres dans ton code.

    Surtout, montres nous comment ces ArrayList sont instanciés.
    Il vaut mieux mobiliser son intelligence sur des conneries que mobiliser sa connerie sur des choses intelligentes --- devise SHADOKS

    Kit de survie Android : mon guide pour apprendre à programmer sur Android, mon tutoriel sur les web services et enfin l'outil en ligne pour vous faire gagner du temps - N'oubliez pas de consulter la FAQ Android

  3. #3
    Expert confirmé
    Avatar de Hephaistos007
    Profil pro
    Enseignant Chercheur
    Inscrit en
    Décembre 2004
    Messages
    2 493
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Enseignant Chercheur
    Secteur : Enseignement

    Informations forums :
    Inscription : Décembre 2004
    Messages : 2 493
    Points : 4 166
    Points
    4 166
    Par défaut
    Je pense à un autre truc lié au multithreading : as-tu essayé avec un Vector plutôt qu'une ArrayList ?
    Il vaut mieux mobiliser son intelligence sur des conneries que mobiliser sa connerie sur des choses intelligentes --- devise SHADOKS

    Kit de survie Android : mon guide pour apprendre à programmer sur Android, mon tutoriel sur les web services et enfin l'outil en ligne pour vous faire gagner du temps - N'oubliez pas de consulter la FAQ Android

  4. #4
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    36
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 36
    Points : 21
    Points
    21
    Par défaut
    Non je n'ai pas essayé avec un vector car je suis moins à l'aise avec
    J'instancie l'ArrayList de la manière suivante au debut de la classe
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    public ArrayList<OverlayItem> overlay = new ArrayList<OverlayItem>();
    Voici la tackTrace
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     java.lang.IndexOutOfBoundsException: Invalid index 3, size is 3 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at org.osmdroid.views.overlay.ItemizedOverlay.getItem(ItemizedOverlay.java:156) at org.osmdroid.views.overlay.ItemizedIconOverlay.activateSelectedItems(ItemizedIconOverlay.java:167) at org.osmdroid.views.overlay.ItemizedIconOverlay.onSingleTapConfirmed(ItemizedIconOverlay.java:117) at org.osmdroid.views.overlay.OverlayManager.onSingleTapConfirmed(OverlayManager.java:212) at org.osmdroid.views.MapView$MapViewDoubleClickListener.onSingleTapConfirmed(MapView.java:1176) at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:341) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5602) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) at dalvik.system.NativeStart.main(Native Method)

  5. #5
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    36
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 36
    Points : 21
    Points
    21
    Par défaut
    Est ce qu'une gestion d'exception pourrait prévenir le problème ? J'ai essayé :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    try{
    }catch(IndexOutOfBoundsException e){
                        e.printStackTrace();
                    }
    Mais cela ne marche pas ?

  6. #6
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    36
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 36
    Points : 21
    Points
    21
    Par défaut
    *cela ne marche pas .

  7. #7
    Expert éminent

    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Février 2007
    Messages
    4 253
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Février 2007
    Messages : 4 253
    Points : 7 618
    Points
    7 618
    Billets dans le blog
    3
    Par défaut
    C'est surtout horrible...

    Ca me rappelle un programmeur qui par flemme de faire un test si null faisait un catch de NullPointerException !!

    Non... par définition une RuntimeException ne devrait *jamais* être catchée, et indique une erreur de programmation. Ou un état système anormal.

    Il faudrait voir plus de code, parce que là sinon...
    N'oubliez pas de cliquer sur mais aussi sur si un commentaire vous a été utile !
    Et surtout

  8. #8
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    36
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 36
    Points : 21
    Points
    21
    Par défaut
    Voila la classe complète et avant d'autre commentaires oui il est horrible et doit certainement vous piquer les yeux mais comme vous pouvez le constater dans la description je suis étudiant et ai commencé l'apprentissage d'android depuis peu
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926
    927
    928
    929
    930
    931
    932
    933
    934
    935
    936
    937
    938
    939
    940
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957
    958
    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    974
    975
    976
    977
    978
    979
    980
    981
    982
    983
    984
    985
    986
    987
    import android.app.Activity;
    import android.app.AlertDialog;
    import android.content.Context;
    import android.content.DialogInterface;
    import android.content.Intent;
    import android.graphics.Color;
    import android.location.Location;
    import android.location.LocationListener;
    import android.location.LocationManager;
    import android.os.Bundle;
    import android.os.Environment;
    import android.os.SystemClock;
    import android.util.Log;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.view.View;
    import android.widget.AdapterView;
    import android.widget.ArrayAdapter;
    import android.widget.Button;
    import android.widget.Chronometer;
    import android.widget.EditText;
    import android.widget.LinearLayout;
    import android.widget.ListView;
    import android.widget.RelativeLayout;
    import android.widget.TextView;
    import android.widget.Toast;
     
    import com.example.pcdequentin.database.Station;
    import com.example.pcdequentin.database.StationDatabase;
    import com.example.pcdequentin.database.TachyPoint;
    import com.example.pcdequentin.database.TachyPointDatabase;
    import com.example.pcdequentin.database.TopoPoint;
    import com.example.pcdequentin.database.TopoPointDatabase;
     
    import org.osmdroid.DefaultResourceProxyImpl;
    import org.osmdroid.ResourceProxy;
    import org.osmdroid.api.IMapController;
    import org.osmdroid.bonuspack.overlays.Polyline;
    import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
    import org.osmdroid.util.GeoPoint;
    import org.osmdroid.views.MapController;
    import org.osmdroid.views.MapView;
    import org.osmdroid.views.overlay.ItemizedIconOverlay;
    import org.osmdroid.views.overlay.OverlayItem;
    import org.osmdroid.views.overlay.PathOverlay;
    import org.osmdroid.views.overlay.SimpleLocationOverlay;
     
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
     
     
    public class Map extends Activity implements LocationListener {
     
        private TextView montexte = null; // display coordinates
        private RelativeLayout layout = null;
        private MapView mMapView; // OSM map
        private IMapController mMapController; // Controller to interact with the OSM view
        private double aLatitude, aLongitude; // coordinates
        private PathOverlay pathOverlay; // OSM view overlay that displays current path
        private SimpleLocationOverlay locationOverlay; // overlays that display current location
        public boolean station = false;
        public boolean speed = false;
        public boolean traction = false;
        public Chronometer chronometer;
        public ItemizedIconOverlay<OverlayItem> myLocationOverlay;
        public ItemizedIconOverlay<OverlayItem> myLocationOverlayfeu;
        public ItemizedIconOverlay<OverlayItem> myLocationOverlayslt;
        public ItemizedIconOverlay<OverlayItem> myLocationOverlaydir;
        public ItemizedIconOverlay<OverlayItem> myLocationOverlayrtrac;
        public ItemizedIconOverlay<OverlayItem> myLocationOverlayctrac;
        public Polyline p;
        public ArrayList<GeoPoint> mTrace;
        public boolean go;
        public boolean loc = false;
        public GeoPoint gPt;
        public ArrayList<OverlayItem> overlayfeu = new ArrayList<OverlayItem>();
        public ArrayList<OverlayItem> overlayslt = new ArrayList<OverlayItem>();
        public ArrayList<OverlayItem> overlaydir = new ArrayList<OverlayItem>();
        public ArrayList<OverlayItem> overlayrtrac = new ArrayList<OverlayItem>();
        public ArrayList<OverlayItem> overlayctrac = new ArrayList<OverlayItem>();
        TopoPointDatabase TopoPointDatabase = new TopoPointDatabase(this);
        TachyPointDatabase TachyPointDatabase = new TachyPointDatabase(this);
        TachyPoint tachy;
        int vitesselim = 30;
        String Releve;
        private StationDatabase datasource;
        ArrayAdapter<String> adapter;
     
        //////    // $$$$$$$$ A RAJOUTER $$$$$$$$$$
        private TopoPointDatabase datasource_topo;
        private TachyPointDatabase datasource_tachy;
        private String texte_a_envoyer;
        private File mFile = null;
    ////////////    //$$$$$$$$$$$$$$$$$
     
     
     
        @Override
        protected void onCreate(Bundle savedInstanceState) {
     
            super.onCreate(savedInstanceState);
            layout = (RelativeLayout) RelativeLayout.inflate(this, R.layout.activity_map, null);
            go=false;
            setContentView(layout);
            // OSM map
            initiateOSMView();
            LocationManager locationManager = (LocationManager)getSystemService(LOCATION_SERVICE); // Access to ACCESS_FINE_LOCATION
            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 5, this);// Get the actual location, every 5 seconds or 5 meters
            p = new Polyline(mMapView.getContext());
            p.setColor(0xAAFF3300);
            p.setWidth(5.0f);
            mTrace = new ArrayList<GeoPoint>();
     
            setResult(0); // Destruction de l'activity précédente
     
            // Toasts
            final Toast toast = Toast.makeText(this, "Station ajoutée", Toast.LENGTH_SHORT);
            final Toast toast2 = Toast.makeText(this, "Attendez la localisation", Toast.LENGTH_SHORT);
            final Toast toast3 = Toast.makeText(this, "Station ajoutée", Toast.LENGTH_SHORT);
            final Toast toast4 = Toast.makeText(this, "Feu ajouté", Toast.LENGTH_SHORT);
            final Toast toast5 = Toast.makeText(this, "Signalisation lumineuse ajoutée", Toast.LENGTH_SHORT);
            final Toast toast6 = Toast.makeText(this, "Signal de direction ajouté", Toast.LENGTH_SHORT);
            final Toast toast7 = Toast.makeText(this, "Signal coupé traction ajouté", Toast.LENGTH_SHORT);
            final Toast toast8 = Toast.makeText(this, "Signal rétablir traction ajouté", Toast.LENGTH_SHORT);
            final Toast toast9 = Toast.makeText(this, "Fichier créé", Toast.LENGTH_SHORT);
     
            final ListView list = (ListView) findViewById(R.id.listView_stations_map);
            final EditText edit_station = (EditText) findViewById(R.id.editText_station);
            final Button creer = (Button) findViewById(R.id.creer_station_map);
     
            datasource = new StationDatabase(this);
            datasource_tachy = new TachyPointDatabase(this);
            datasource_topo = new TopoPointDatabase(this);
            datasource.open();
            datasource_tachy.open();
            datasource_topo.open();
     
            Bundle extras = getIntent().getExtras();
     
            if (extras != null) {
                Releve = extras.getString("Releve");
            }
     
            ///////////        // $$$$$$$$ A RAJOUTER $$$$$$$$$$
     
            mFile = new File(Environment.getExternalStorageDirectory().getPath() + "/Android/" + Releve + ".txt");
     
            /////////       //$$$$$$$$$$$$$$$$$$$$$
     
            List<String> values = datasource.getStationWithReleve(Releve);
     
            adapter = new ArrayAdapter<String>(this,
                    android.R.layout.simple_list_item_1, values);
            list.setAdapter(adapter);
     
            // ListView Item Click Listener
            list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
     
                @Override
                public void onItemClick(AdapterView<?> parent, View view,
                                        int position, long id) {
     
     
                    String name =adapter.getItem(position);
                    long time2 = (SystemClock.elapsedRealtime() - chronometer.getBase())/1000;
                    Station station = new Station();
                    datasource.open();
     
     
                    station = datasource.getStationWithName(name);
     
                    station.setLatitude(aLatitude);
                    station.setLongitude(aLongitude);
                    station.setTime(time2);
     
                    //datasource.add(station);
                    datasource.update(station);
                    datasource.close();
     
     
     
                    overlayrtrac.add(new OverlayItem("New Overlay", "Overlay Description", gPt));
                    ResourceProxy resourceProxyrtrac = new DefaultResourceProxyImpl(getApplicationContext());
     
                    myLocationOverlayrtrac = new ItemizedIconOverlay<OverlayItem>(overlayrtrac,getResources().getDrawable(R.drawable.stationsmall), null, resourceProxyrtrac);
                    mMapView.getOverlays().add(myLocationOverlayrtrac);
                    toast3.show();
     
     
     
     
     
                }
     
            });
     
     
     
     
     
     
     
     
            // The Button which allows you to fill the different parameters
            final Button Button_set = (Button) findViewById(R.id.button_set);
            Button_set.setOnClickListener(new View.OnClickListener() {
     
     
                // Déclaration de l'intent qui nous dirigera vers la page d'accueil
     
                public void onClick(View v) {
     
                    Intent intent = new Intent(Map.this, Fill.class); // Activity actuelle vers activity de destination
                    startActivity(intent);
                }
            });
     
            creer.setOnClickListener(new View.OnClickListener() {
     
     
                // Déclaration de l'intent qui nous dirigera vers la page d'accueil
     
                public void onClick(View v) {
     
                    String NomStation = edit_station.getText().toString();
     
                    Station new_station = new Station();
                    new_station.setName(NomStation);
                    new_station.setNomreleve(Releve);
                    datasource.add(new_station);
     
                    List<String> values2 = datasource.getStationWithReleve(Releve);
     
                    adapter = new ArrayAdapter<String>(getApplicationContext(),
                            android.R.layout.simple_list_item_1, values2);
                    list.setAdapter(adapter);
                    toast.show();
     
                }
            });
     
            // Button GO, start the timer
            final Button Button_go = (Button) findViewById(R.id.button_go);
            Button_go.setOnClickListener(new View.OnClickListener() {
     
     
                // Intent which directs you to the following activity
     
                public void onClick(View v) {
     
                    if (!loc){
                        Context context = getApplicationContext();
     
                        toast2.show();
     
     
                    }
                    if (loc){
                    go=true;
                    final RelativeLayout MainButtons = (RelativeLayout) findViewById(R.id.menu_button);
                    chronometer = (Chronometer) findViewById(R.id.chronometer);
                    Button_go.setVisibility(View.GONE);
                    Button_set.setVisibility(View.GONE);
                    chronometer.setBase(SystemClock.elapsedRealtime());
                    chronometer.start();
                    MainButtons.setVisibility(View.VISIBLE);}
                            }
            });
     
            // Button limit, we display all the different existent limits
            final Button Limit = (Button) findViewById(R.id.button_limit);
            Limit.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
                    final LinearLayout MenuSpeed = (LinearLayout) findViewById(R.id.speed_menu_1);
                    final LinearLayout MenuSpeed_2 = (LinearLayout) findViewById(R.id.speed_menu_2);
                    final LinearLayout MenuStation = (LinearLayout) findViewById(R.id.menu_station);
                    final LinearLayout MenuTraction = (LinearLayout) findViewById(R.id.traction_menu);
     
                    if (speed == false){
                        speed = true;
                        MenuSpeed.setVisibility(View.VISIBLE);
                        MenuSpeed_2.setVisibility(View.VISIBLE);
                        if(station == true){
                            MenuStation.setVisibility(View.INVISIBLE);
     
                            station=false;
                        }
     
                        if(traction == true){
     
                            MenuTraction.setVisibility(View.INVISIBLE);
                            station=false;
                        }
     
     
     
     
                    }else{
                        speed=false;
                        MenuSpeed.setVisibility(View.INVISIBLE);
                        MenuSpeed_2.setVisibility(View.INVISIBLE);
                    }
                }
            });
     
     
            final Button button_rtraction = (Button) findViewById(R.id.button_rtraction);
            button_rtraction.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    final LinearLayout MenuSpeed = (LinearLayout) findViewById(R.id.speed_menu_1);
                    final LinearLayout MenuSpeed_2 = (LinearLayout) findViewById(R.id.speed_menu_2);
                    final LinearLayout MenuStation = (LinearLayout) findViewById(R.id.menu_station);
                    final LinearLayout MenuTraction = (LinearLayout) findViewById(R.id.traction_menu);
     
                    if (traction == false){
                        traction = true;
                        MenuTraction.setVisibility(View.VISIBLE);
     
                        if(speed == true){
                            MenuSpeed.setVisibility(View.INVISIBLE);
                            MenuSpeed_2.setVisibility(View.INVISIBLE);
     
                            speed=false;
                        }
     
                        if(station == true){
                            MenuStation.setVisibility(View.INVISIBLE);
     
                            station=false;
                        }
     
                    }else{
                        traction=false;
                        MenuTraction.setVisibility(View.INVISIBLE);
                    }
     
     
     
     
     
     
     
                }
            });
     
     
            final Button button_rtraction2 = (Button) findViewById(R.id.button_rtraction2);
            button_rtraction2.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
     
                    String type = "Remettre traction";
     
                    long time2 = (SystemClock.elapsedRealtime() - chronometer.getBase())/1000;
                    TopoPoint rtrac = new TopoPoint(type, aLatitude, aLongitude, time2, Releve);
                    TopoPointDatabase.open();
                    TopoPointDatabase.add(rtrac);
     
                    try {
                        overlayrtrac.add(new OverlayItem("New Overlay", "Overlay Description", gPt));
                        ResourceProxy resourceProxyrtrac = new DefaultResourceProxyImpl(getApplicationContext());
     
                        myLocationOverlayrtrac = new ItemizedIconOverlay<OverlayItem>(overlayrtrac, getResources().getDrawable(R.drawable.rtraction2), null, resourceProxyrtrac);
                        mMapView.getOverlays().add(myLocationOverlayrtrac);
                    }catch(IndexOutOfBoundsException e){
                        e.printStackTrace();
                    }
                    toast8.show();
     
                    // Ajout de la signalisation lumineuse de trafic dans la base de donnee
     
     
     
     
     
     
     
     
     
     
     
     
     
     
                }
            });
     
     
            final Button button_ctraction = (Button) findViewById(R.id.button_ctraction);
            button_ctraction.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    int idline = '0';
                    String type = "Couper traction";
                    String description = " ";
                    long time2 = (SystemClock.elapsedRealtime() - chronometer.getBase())/1000;
                    TopoPoint ctrac = new TopoPoint(type, aLatitude, aLongitude, time2, Releve);
                    TopoPointDatabase.open();
                    TopoPointDatabase.add(ctrac);
     
                    try{
                    overlayctrac.add(new OverlayItem("New Overlay", "Overlay Description", gPt));
                    ResourceProxy resourceProxyctrac = new DefaultResourceProxyImpl(getApplicationContext());
     
                    myLocationOverlayctrac = new ItemizedIconOverlay<OverlayItem>(overlayctrac,getResources().getDrawable(R.drawable.ctraction2), null, resourceProxyctrac);
                    mMapView.getOverlays().add(myLocationOverlayctrac);
     
                    }catch(IndexOutOfBoundsException e){
                        e.printStackTrace();
                    }
                    toast7.show();
     
     
     
                    // Ajout de la signalisation lumineuse de trafic dans la base de donnee
     
     
     
     
     
                }
            });
     
     
     
     
            // Button station
            final Button Station = (Button) findViewById(R.id.button_station);
            Station.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the station selection
     
                public void onClick(View v) {
                    final LinearLayout MenuStation = (LinearLayout) findViewById(R.id.menu_station);
                    final LinearLayout MenuSpeed = (LinearLayout) findViewById(R.id.speed_menu_1);
                    final LinearLayout MenuSpeed_2 = (LinearLayout) findViewById(R.id.speed_menu_2);
                    final LinearLayout MenuTraction = (LinearLayout) findViewById(R.id.traction_menu);
     
                    if (station==false){
                        station=true;
                        MenuStation.setVisibility(View.VISIBLE);
                        if(speed==true){
                            MenuSpeed.setVisibility(View.INVISIBLE);
                            MenuSpeed_2.setVisibility(View.INVISIBLE);
     
                            speed=false;
                        }
     
                        if(traction == true){
     
                            MenuTraction.setVisibility(View.INVISIBLE);
                            traction=false;
                        }
                    }else{
                        station=false;
                        MenuStation.setVisibility(View.INVISIBLE);
                    }
                }
            });
     
     
     
     
     
            final Button feub = (Button) findViewById(R.id.button_feub);
            feub.setOnClickListener(new View.OnClickListener(){
                public void onClick(View v) {
     
     
                    int idline = '0';
                    String type = "SLT";
                    String description = " ";
                    long time2 = (SystemClock.elapsedRealtime() - chronometer.getBase())/1000;
                    TopoPoint slt = new TopoPoint(type, aLatitude, aLongitude, time2, Releve);
                    TopoPointDatabase.open();
                    TopoPointDatabase.add(slt);
                    try{
                    overlayslt.add(new OverlayItem("New Overlay", "Overlay Description", gPt));
                    ResourceProxy resourceProxyfeub = new DefaultResourceProxyImpl(getApplicationContext());
     
                    myLocationOverlayslt = new ItemizedIconOverlay<OverlayItem>(overlayslt,getResources().getDrawable(R.drawable.feub2), null, resourceProxyfeub);
                    mMapView.getOverlays().add(myLocationOverlayslt);
                    }catch(IndexOutOfBoundsException e){
                        e.printStackTrace();
                    }
                    toast5.show();
     
                    // Ajout de la signalisation lumineuse de trafic dans la base de donnee
     
     
     
     
                }
     
            });
     
     
     
            final Button feu = (Button) findViewById(R.id.button_feu);
            feu.setOnClickListener(new View.OnClickListener(){
                public void onClick(View v) {
     
     
                    String type = "FEU";
                    long time2 = (SystemClock.elapsedRealtime() - chronometer.getBase())/1000;
                    TopoPoint feu = new TopoPoint(type, aLatitude, aLongitude, time2, Releve);
                    TopoPointDatabase.open();
                    TopoPointDatabase.add(feu);
     
                    try{
                    overlayfeu.add(new OverlayItem("New Overlay", "Overlay Description", gPt));
                    ResourceProxy resourceProxyfeu = new DefaultResourceProxyImpl(getApplicationContext());
     
                    myLocationOverlayfeu = new ItemizedIconOverlay<OverlayItem>(overlayfeu,getResources().getDrawable(R.drawable.feu2), null, resourceProxyfeu);
                    mMapView.getOverlays().add(myLocationOverlayfeu);
                    }catch(IndexOutOfBoundsException e){
                        e.printStackTrace();
                    }
                    toast4.show();
     
     
     
     
     
                }
     
            });
     
     
     
     
     
            final Button direction = (Button) findViewById(R.id.button_manoeuvre);
            direction.setOnClickListener(new View.OnClickListener(){
                public void onClick(View v) {
     
     
                    int idline = '0';
                    String type = "Signal de direction";
                    String description = " ";
                    long time2 = (SystemClock.elapsedRealtime() - chronometer.getBase())/1000;
                    TopoPoint dir = new TopoPoint(type, aLatitude, aLongitude, time2, Releve);
                    TopoPointDatabase.open();
                    TopoPointDatabase.add(dir);
     
     
     
                    try{
                    overlaydir.add(new OverlayItem("New Overlay", "Overlay Description", gPt));
                    ResourceProxy resourceProxydir = new DefaultResourceProxyImpl(getApplicationContext());
     
                    myLocationOverlaydir = new ItemizedIconOverlay<OverlayItem>(overlaydir,getResources().getDrawable(R.drawable.direction2), null, resourceProxydir);
                    mMapView.getOverlays().add(myLocationOverlaydir);
                    }catch(IndexOutOfBoundsException e){
                        e.printStackTrace();
                    }
                    toast6.show();
     
     
     
     
     
                }
     
            });
     
     
            final Button fin = (Button) findViewById(R.id.button_end);
            fin.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    Intent intent = new Intent(Map.this, MesStations.class);  //Lancer l'activit� DisplayVue
                    startActivity(intent);    //Afficher la vue
     
     
     
     
                }
            });
     
            final Button fin2 = (Button) findViewById(R.id.button_end2);
            fin2.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    Intent intent = new Intent(Map.this, MyTopoPoints.class);  //Lancer l'activit� DisplayVue
                    startActivity(intent);    //Afficher la vue
     
     
     
     
                }
            });
     
            final Button fin3 = (Button) findViewById(R.id.button_end3);
            fin3.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    //Intent intent = new Intent(Map.this, MesStations.class);  //Lancer l'activit� DisplayVue
                    // startActivity(intent);    //Afficher la vue
     
    ///////////////////////////// A RAJOUTER $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
                    try {
     
     
     
     
                        String eol = System.getProperty("line.separator");
                        FileOutputStream output = openFileOutput(Releve, MODE_PRIVATE);
     
                        // Flux externe
                        // Si le fichier est lisible et qu'on peut écrire dedans
                        if(Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
                                && !Environment.MEDIA_MOUNTED_READ_ONLY.equals(Environment.getExternalStorageState())) {
     
                            // On crée un nouveau fichier. Si le fichier existe déjà, il ne sera pas créé
                            // Création du Fichier GPX ou XML
                            mFile.createNewFile();
     
                            output = new FileOutputStream(mFile);
     
                            // Stations
                            List<Station> values = datasource.getAllCommentsWithReleve(Releve);
                            for (int i = 0; i<values.size();i++){
                                texte_a_envoyer = "<station>"
     
                                        + eol + "   <id_station>"
                                        + eol + "        " + values.get(i).getId()
                                        + eol + "   </id_station>"
     
                                        + eol + "   <name>"
                                        + eol + "        " + values.get(i).getName()
                                        + eol + "   </name>"
     
                                        + eol + "   <nom_releve>"
                                        + eol + "        " + values.get(i).getNomreleve()
                                        + eol + "   </nom_releve>"
     
                                        + eol + "   <latitude_station>"
                                        + eol + "        " + values.get(i).getLatitude()
                                        + eol + "   </latitude_station>"
     
                                        + eol + "   <longitude_station>"
                                        + eol + "        " + values.get(i).getLongitude()
                                        + eol + "   </longitude_station>"
     
                                        + eol + "   <timer_station>"
                                        + eol + "        " + values.get(i).getTime()
                                        + eol + "   </timer_station>"
     
                                        + eol +"</station>" + eol;
                                output.write(texte_a_envoyer.getBytes());
     
                            }
                            // TopoPoints
                            List<TopoPoint> values_topo = datasource_topo.getAllCommentsWithReleve(Releve);
                            for (int i = 0; i<values_topo.size();i++){
                                texte_a_envoyer = "<topopoint>"
     
                                        + eol + "   <id_point>"
                                        + eol + "        " + values_topo.get(i).getId()
                                        + eol + "   </id_point>"
     
                                        + eol + "   <type>"
                                        + eol + "        " + values_topo.get(i).getType()
                                        + eol + "   </type>"
     
                                        + eol + "   <nom_releve>"
                                        + eol + "        " + values_topo.get(i).getNomreleve()
                                        + eol + "   </nom_releve>"
     
                                        + eol + "   <latitude_point>"
                                        + eol + "        " + values_topo.get(i).getLatitude()
                                        + eol + "   </latitude_point>"
     
                                        + eol + "   <longitude_point>"
                                        + eol + "        " + values_topo.get(i).getLongitude()
                                        + eol + "   </longitude_point>"
     
                                        + eol + "   <timer_point>"
                                        + eol + "        " + values_topo.get(i).getTimer()
                                        + eol + "   </timer_point>"
     
                                        + eol +"</topopoint>" + eol;
                                output.write(texte_a_envoyer.getBytes());
     
                            }
                            // TopoPoints
                            List<TachyPoint> values_tachy = datasource_tachy.getAllCommentsWithReleve(Releve);
                            for (int i = 0; i<values_tachy.size();i++){
                                texte_a_envoyer = "<tachypoint>"
     
                                        + eol + "   <id_tachy>"
                                        + eol + "        " + values_tachy.get(i).getId()
                                        + eol + "   </id_tachy>"
     
                                        + eol + "   <vitesse>"
                                        + eol + "        " + values_tachy.get(i).getVitesselim()
                                        + eol + "   </vitesse>"
     
                                        + eol + "   <nom_releve>"
                                        + eol + "        " + values_tachy.get(i).getNomreleve()
                                        + eol + "   </nom_releve>"
     
                                        + eol + "   <latitude_tachy>"
                                        + eol + "        " + values_tachy.get(i).getLatitude()
                                        + eol + "   </latitude_tachy>"
     
                                        + eol + "   <longitude_tachy>"
                                        + eol + "        " + values_tachy.get(i).getLongitude()
                                        + eol + "   </longitude_tachy>"
     
                                        + eol + "   <timer_tachy>"
                                        + eol + "        " + values_tachy.get(i).getTime()
                                        + eol + "   </timer_tachy>"
     
                                        + eol +"</tachypoint>" + eol;
                                output.write(texte_a_envoyer.getBytes());
     
                            }
                            if(output != null)
                                output.close();
     
                        }
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
     
     
                }
    ///////////////////////////$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
            });
     
     
            final Button limit15 = (Button) findViewById(R.id.button_15);
            limit15.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    Limit.setText("15");
                    vitesselim = 15;
     
     
     
     
     
                }
            });
     
            final Button limit30 = (Button) findViewById(R.id.button_30);
            limit30.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    Limit.setText("30");
                    vitesselim = 30;
     
     
     
     
     
                }
            });
     
            final Button limit40 = (Button) findViewById(R.id.button_40);
            limit40.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    Limit.setText("40");
                    vitesselim = 40;
     
     
     
     
     
                }
            });
     
            final Button limit45 = (Button) findViewById(R.id.button_45);
            limit45.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    Limit.setText("45");
                    vitesselim = 45;
     
     
     
     
     
                }
            });
     
            final Button limit50 = (Button) findViewById(R.id.button_50);
            limit50.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    Limit.setText("50");
                    vitesselim = 50;
     
     
     
     
     
                }
            });
     
            final Button limit60 = (Button) findViewById(R.id.button_60);
            limit60.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    Limit.setText("60");
                    vitesselim = 60;
     
     
     
     
     
                }
            });
     
            final Button limit70 = (Button) findViewById(R.id.button_70);
            limit70.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    Limit.setText("70");
                    vitesselim = 70;
     
     
     
     
     
                }
            });
     
            final Button limit80 = (Button) findViewById(R.id.button_80);
            limit80.setOnClickListener(new View.OnClickListener() {
     
                // It shows the menu for the speed limits
     
                public void onClick(View v) {
     
                    Limit.setText("80");
                    vitesselim = 80;
     
     
                }
            });
     
        }
     
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            //getMenuInflater().inflate(R.menu.menu_map, menu);
            return true;
        }
     
        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // Handle action bar item clicks here. The action bar will
            // automatically handle clicks on the Home/Up button, so long
            // as you specify a parent activity in AndroidManifest.xml.
            //int id = item.getItemId();
     
            //noinspection SimplifiableIfStatement
            //if (id == R.id.action_settings) {
            return true;
            //}
     
            //return super.onOptionsItemSelected(item);
        }
     
        @Override
        public void onLocationChanged(Location location) {
     
            loc = true;
            Log.d("GPS", "Latitude " + location.getLatitude() + " et longitude " + location.getLongitude());
            montexte = (TextView)findViewById(R.id.coordinate);
            montexte.setText("Latitude " + location.getLatitude() + " et longitude " + location.getLongitude());
            aLatitude = location.getLatitude();
            aLongitude = location.getLongitude();
            // Display OSM Map
            gPt = new GeoPoint(aLatitude, aLongitude);
            mMapController.setCenter(gPt);
            mMapView.invalidate();
     
            // Enregistrement des Tachypoints
     
     
     
     
            if(go==true) {
                long time = (SystemClock.elapsedRealtime() - chronometer.getBase())/1000;
     
                tachy=new TachyPoint(time, aLatitude, aLongitude, vitesselim, Releve);
                TachyPointDatabase.open();
                TachyPointDatabase.add(tachy);
                mTrace.add(new GeoPoint(aLatitude, aLongitude));
                p.setPoints(mTrace);
                mMapView.getOverlays().add(p);
            }
     
            ArrayList<OverlayItem> overlays = new ArrayList<OverlayItem>();
            overlays.add(new OverlayItem("New Overlay", "Overlay Description", gPt));
            ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getApplicationContext());
            if(myLocationOverlay!=null){
                myLocationOverlay.removeAllItems();
            }
            myLocationOverlay = new ItemizedIconOverlay<OverlayItem>(overlays,getResources().getDrawable(R.drawable.point_orange), null, resourceProxy);
            mMapView.getOverlays().add(myLocationOverlay);
     
     
        }
     
        @Override
        public void onStatusChanged(String provider, int status, Bundle extras) {
     
        }
     
        @Override
        public void onProviderEnabled(String provider) {
     
        }
     
        @Override
        public void onProviderDisabled(String provider) {
     
        }
     
        public void initiateOSMView() {
            mMapView = (MapView)findViewById(R.id.mapview);
            mMapView.setMultiTouchControls(true);       // pinch to zoom
            mMapController = mMapView.getController();
            mMapView.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
            mMapController.setZoom(19);
            GeoPoint mapCenter = new GeoPoint(48.856614, 2.352222);
            mMapController.setCenter(mapCenter);
        }
     
     
    }

  9. #9
    Expert éminent

    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Février 2007
    Messages
    4 253
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Février 2007
    Messages : 4 253
    Points : 7 618
    Points
    7 618
    Billets dans le blog
    3
    Par défaut
    J'ai juste dit que "rajouter" un catch de ArrayOutOfBoundException était la pire des solution...

    Ensuite, rien à voir avec Android... mais un peu de lecture de java serait pas mal...
    Par exemple:
    autant faire: non ? (heureusement je crois que le compilo sait transformer).

    Ou encore:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
            layout = (RelativeLayout) RelativeLayout.inflate(this, R.layout.activity_map, null);
            go=false;
            setContentView(layout);
    La variable "layout" n'est utilisée nulle part... pourquoi la stocker dans l'instance d'activité ? pourquoi ne pas faire simplement:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    setContentView(R.layout.activity_map);
    ?


    Mais bon... en l'occurence... la partie de code qui m'interessait était surtout: org.osmdroid.views.overlay.ItemizedIconOverlay et org.osmdroid.views.overlay.OverlayManager puisque ce sont elles qui font crasher:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    java.lang.IndexOutOfBoundsException: Invalid index 3, size is 3 
    at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) 
    at java.util.ArrayList.get(ArrayList.java:308) 
    at org.osmdroid.views.overlay.ItemizedOverlay.getItem(ItemizedOverlay.java:156) 
    at org.osmdroid.views.overlay.ItemizedIconOverlay.activateSelectedItems(ItemizedIconOverlay.java:167) 
    at org.osmdroid.views.overlay.ItemizedIconOverlay.onSingleTapConfirmed(ItemizedIconOverlay.java:117) 
    at org.osmdroid.views.overlay.OverlayManager.onSingleTapConfirmed(OverlayManager.java:212) 
    ...
    N'oubliez pas de cliquer sur mais aussi sur si un commentaire vous a été utile !
    Et surtout

Discussions similaires

  1. Erreur java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
    Par impossibeulman dans le forum Débuter avec Java
    Réponses: 3
    Dernier message: 07/08/2008, 15h18
  2. message erreur java.lang.IndexOutOfBoundsException
    Par coquero dans le forum Langage
    Réponses: 2
    Dernier message: 20/05/2008, 15h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo