Salut,
Je fais face à une erreur dont je ne connais pas l'origine:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
12-30 22:29:58.290: E/AndroidRuntime(22933): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.trainingcenter/com.example.trainingcenter.CalculDistance}: java.lang.IllegalStateException: attempt to re-open an already-closed object: android.database.sqlite.SQLiteQuery (mSql = SELECT _id, libellé, tel, email, adresse, ville, catégorie, latitude, longitude FROM table_formation)
la classe CalculDistance qui calcule le plus proche point par rapport à la localisation de l'utilisateur:
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
public class CalculDistance extends MapActivity implements LocationListener {
	double latitudeUser;
	double longitudeUser;
	FormationBDD formationBdd;
	Formation formation;
 
	MapView	mapView = null;
	 private LocationManager lm = null;
	MapController mc = null;
	List<Formation> listF = new ArrayList<Formation>();
 
	 public void onCreate(Bundle savedInstanceState) {
		 super.onCreate(savedInstanceState);
			setContentView(R.layout.localisation);
			mapView = (MapView) this.findViewById(R.id.mapview);
			mapView.setBuiltInZoomControls(true);
			lm = (LocationManager) this.getSystemService(LOCATION_SERVICE);
			lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000, 0, this);
			lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 10000, 0,
				this);
 
 
			mc = mapView.getController();
			mc.setZoom(15);
		    formationBdd = new FormationBDD(this);
		    formationBdd.open();
		    listF = formationBdd.getAllFormations();
		    Log.i(getClass().getName(), "la liste contient: " + listF);
 
		    int indexdistanceMin = indexmindistance();
		    double latitudemin = listF.get(indexdistanceMin).getLatitude();
		    double longitudemin = listF.get(indexdistanceMin).getLongitude();
		    GeoPoint point = new GeoPoint(microdegrees(latitudemin),microdegrees(longitudemin));
		    ItemizedOverlayPerso pinOverlay = new ItemizedOverlayPerso(getResources().getDrawable(R.drawable.marker));
			pinOverlay.addPoint(point);
			mapView.getOverlays().add(pinOverlay);
 
	 }
 
 
		@Override
		protected boolean isRouteDisplayed() {
			// TODO Auto-generated method stub
			return false;
		}
 
		 @Override
		    public void onLocationChanged(Location location) {
			latitudeUser = location.getLatitude();
			longitudeUser = location.getLongitude();
 
		}
 
		@Override
		public void onProviderDisabled(String provider) {
			// TODO Auto-generated method stub
 
		}
 
		@Override
		public void onProviderEnabled(String provider) {
			// TODO Auto-generated method stub
 
		}
 
		@Override
		public void onStatusChanged(String provider, int status, Bundle extras) {
			// TODO Auto-generated method stub
 
		}
		private int microdegrees(double value){
			return (int)(value*1000000);
		}
		public class ItemizedOverlayPerso extends ItemizedOverlay<OverlayItem> {
 
		    private List<GeoPoint> points = new ArrayList<GeoPoint>();
 
		    public ItemizedOverlayPerso(Drawable defaultMarker) {
		        super(boundCenterBottom(defaultMarker));
		    }
 
		    @Override
		    protected OverlayItem createItem(int i) {
		        GeoPoint point = points.get(i);
		        return new OverlayItem(point,"Titre", "Description");
		    }
 
		    @Override
		    public int size() {
		        return points.size();
		    }
 
		    public void addPoint(GeoPoint point) {
		        this.points.add(point);
		        populate();
		    }
 
		    public void clearPoint() {
		        this.points.clear();
		        populate();
		    }
}
la fonction de récupération de la liste Formations (listF)
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
public List<Formation> getAllFormations()
	{
		List<Formation> formations = new ArrayList<Formation>();
 
		Cursor cursor = bdd.query(TABLE_FORMATION, new String[]{COL_ID, COL_LIB, COL_TEL, COL_EMAIL, COL_ADR, COL_VILLE, COL_CAT, COL_LAT, COL_LONG}, null, null, null, null, null);
		cursor.moveToFirst();
 
		while (!cursor.isAfterLast())
		{
			formations.add(cursorToFormation(cursor));
			cursor.moveToNext();
		}
 
		cursor.close();
 
		return formations;
	}
private Formation cursorToFormation(Cursor c){
 
		if (c.getCount() == 0)
			return null;
 
 
		c.moveToFirst();
 
		Formation formation = new Formation();
 
		formation.set_id(c.getInt(NUM_COL_ID));
		formation.setLibellé(c.getString(NUM_COL_LIB));
		formation.setTel(c.getString(NUM_COL_TEL));
		formation.setEmail(c.getString(NUM_COL_EMAIL));
		formation.setAdresse(c.getString(NUM_COL_ADR));
		formation.setVille(c.getString(NUM_COL_VILLE));
		formation.setCatégorie(c.getString(NUM_COL_CAT));
		formation.setLatitude(c.getDouble(NUM_COL_LAT));
		formation.setLongitude(c.getDouble(NUM_COL_LONG));
		//On ferme le cursor
 
 
 
		return formation;
	}
Pouvez vous m'aider?