Hello,

i have several gpx files on my sd card and i show them (the filename)
on a listview. if i choose a gpx file, the track is load in another
activity with a listview,too (adress-strings are shown). if i use the
back button, the listview with the filenames is shown again and i can
choose another file. but if i repeat this the third time, i get this
error:

E/AndroidRuntime( 5075): Uncaught handler: thread Thread-16 exiting
due to uncaught exception
E/AndroidRuntime( 5075): java.lang.IllegalArgumentException
E/AndroidRuntime( 5075):        at java.util.AbstractList.subList
(AbstractList.java:757)
E/AndroidRuntime( 5075):        at
de.stefandahmen.android.navtrack.helper.Trackpoint.getTrkptLat
(Trackpoint.java:40)
E/AndroidRuntime( 5075):        at
de.stefandahmen.android.navtrack.NavTrack.update(NavTrack.java:682)
E/AndroidRuntime( 5075):        at java.util.Observable.notifyObservers
(Observable.java:147)
E/AndroidRuntime( 5075):        at java.util.Observable.notifyObservers
(Observable.java:128)
E/AndroidRuntime( 5075):        at
de.stefandahmen.android.navtrack.helper.Trackpoint.setTrkpt
(Trackpoint.java:22)
E/AndroidRuntime( 5075):        at
de.stefandahmen.android.navtrack.helper.XMLHandler.endElement
(XMLHandler.java:110)
E/AndroidRuntime( 5075):        at
org.apache.harmony.xml.ExpatParser.endElement(ExpatParser.java:159)
E/AndroidRuntime( 5075):        at
org.apache.harmony.xml.ExpatParser.append(Native Method)
E/AndroidRuntime( 5075):        at
org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:506)
E/AndroidRuntime( 5075):        at
org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:467)
E/AndroidRuntime( 5075):        at
org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:329)
E/AndroidRuntime( 5075):        at
org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:286)
E/AndroidRuntime( 5075):        at
de.stefandahmen.android.navtrack.NavTrack$1.run(NavTrack.java:129)
E/AndroidRuntime( 5075):        at java.lang.Thread.run(Thread.java:
1060)

I have implement the onKeyDown function for the back button, because
in the second activity i show a listview with strings and if i press
the back button and choose another file, the strings from the first
file is still in the listview and the new strings are appended in this
list.

public boolean onKeyDown(int keyCode, KeyEvent event)
        {
                if (keyCode == KeyEvent.KEYCODE_BACK)
                {
                    Waypoint   wp = Waypoint.getInstance();
                    Trackpoint tp = Trackpoint.getInstance();
                    mapView.getOverlays().clear();
                    wp.clearLists();
                    tp.clearLists();
                    this.i=0;
                    finish(); //does this work??
                    return true;
                }
                else
                    return super.onKeyDown(keyCode, event);
        }

NavTrack.java:682 :
lat = tp.getTrkptLat(this.i);

Trackpoint.java:40:
public double [] getTrkptLat(int pos)
{
...
line 40: sublist = this.trkpt.subList(pos, getTrkptSize()-1);   //i
search for the next 50 trackpoints in the gpx file
...
}

XMLHandler 110:
this.tp.setTrkpt(newAddress); //address with lat and lon

Thanks in advance,
Stefan

PS: i test it with one file.. choose the file and press beack button..
in the third iteration i get the error above.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to