Bonjour,
j'ai un problème qui est le suivant:
Mon appli charge des informations à savoir des photos des étapes et des voyages. Quand je rentre sur une étape sur lequel il y a des photos, j'ai l'occasion de les voirs via une galerie d'image comme le tuto "http://mickael-lt.developpez.com/tutoriels/android/creation-galerie-connectee/".
Quand j’exécute le tuto no pbl, mais des que je souhaites charger mes images il tombe. il me dit comme quoi il il y a un problème de pointeur.

Voici le code:
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
package cap.android.peoplewhotravel.partage;
 
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
 
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.Toast;
import cap.android.peoplewhotravel.PwtProvider;
import cap.android.peoplewhotravel.R;
import cap.android.peoplewhotravel.etape.Etape;
 
public class Affichage extends Activity {
	static Partages photo;
	//Button btn_sup_photo;
 
	static int id_users;
	static int id_etps;
	static int id_vyg;
	static int envoi;
	static int pht;
 
	//ImageView image;
		private final static String SERVER_IM = "http://***.***.***.***/***/****/****/*****";
 
		// GUI
		private Gallery gallery;
		private ImageView imgView;
 
		//Data
		private ArrayList<URL> mListImages;
		private Drawable mNoImage;
 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	    setContentView(R.layout.main);
	    Bundle b    = getIntent().getExtras();
	    Intent intent = getIntent();
	    photo = b.getParcelable("VOIR PHOTO");
	    //Toast.makeText(Affichage.this,"Entrée !!! ", Toast.LENGTH_SHORT).show();
	    //recupération des vars
	    //final String position = intent.getExtras().getString("url");
        final int envoie = intent.getExtras().getInt("renvoie");
        envoi = envoie;
        final int id_etp = intent.getExtras().getInt("id etape");
        id_etps = id_etp;
        final int id_user = intent.getExtras().getInt("id user");
        id_users = id_user;
        final int id_voyage = intent.getExtras().getInt("id voyage");
        id_vyg = id_voyage;
        final int nbr_pht = intent.getExtras().getInt("nbr photos");
        pht = nbr_pht;
 
	    //Récupération d'une image par défaut à afficher en cas d'erreur ou de liste vide
	    mNoImage = this.getResources().getDrawable(R.drawable.no_image);
 
  		//Construction des URL pour les images
  		mListImages = buildListImages();
 
  		//Récupération du composant affichant l'image en grand
		imgView = (ImageView)findViewById(R.id.imageview_img);
 
		//On lui met une image par défaut (la premiere de la liste ou à défaut l'image d'erreur)
		if (mListImages.size() <= 0) {
			imgView.setImageDrawable(mNoImage); 
		} else {
			setImage(imgView, mListImages.get(0));				
		}
 
		//Récupération du composant affichant la liste des vignettes
		gallery = (Gallery) findViewById(R.id.gallery_img);
		//On lui donne notre adapter qui s'occupéra de l'alimenter en vignette
		gallery.setAdapter(new AddImgAdp(this));
		//Espacement entre les vignette
		gallery.setSpacing(10);
 
	 }
	private void setImage(ImageView aView, URL aURL) {
		// TODO Auto-generated method stub
		try {
			URLConnection conn = aURL.openConnection();
			conn.connect();
			InputStream is = conn.getInputStream();
 
			// Bufferisation pour le téléchargement 
			BufferedInputStream bis = new BufferedInputStream(is, 8192);
 
			// Création de l'image depuis le flux des données entrant
			Bitmap bm = BitmapFactory.decodeStream(bis);
			bis.close();
			is.close();
 
			// Fixe l'image sur le composant ImageView
			aView.setImageBitmap(bm);
 
		} catch (IOException e) {
			aView.setImageDrawable(mNoImage);
			Log.e("DVP Gallery", "Erreur téléchargement image URL : " + aURL.toString());
			e.printStackTrace();
		} 
	}
	private ArrayList<URL> buildListImages() {
		//chargement de photos
		ContentResolver nb_pht = getContentResolver();
		//String id_photo = PwtProvider.M_ID_PARTAGE_URI_PHOTO + " <> null";
 		String photo = PwtProvider.M_ID_PARTAGE_ETAPE + " = 0 AND " + PwtProvider.M_ID_PARTAGE_VOYAGE + " = 0";
		String order = PwtProvider.M_ID_SHOW_PARTAGE + " ASC";
		Cursor pht_mbl = nb_pht.query(PwtProvider.CONTENT_URI_PARTAGES,null,photo,null,order);
		Integer nbre_pict = pht_mbl.getCount();
		ArrayList<URL> listFic = new ArrayList<URL>();
		//
		if(nbre_pict != 0 && pht_mbl.moveToFirst()){
			do{
			//for(int i = 1; i <= nbTotalImage; i++) {
			try {
				//String nom = pht_mbl.getString(PwtProvider.M_ID_PARTAGE_URI_PHOTO_COLUMN);
				listFic.add(new URL(SERVER_IM+pht_mbl.getString(PwtProvider.M_ID_PARTAGE_URI_PHOTO_COLUMN)));
				//Log.i("DVP Gallery", " : " + SERVER_IM+pht_mbl.getString(PwtProvider.M_ID_PARTAGE_URI_PHOTO_COLUMN));
			} catch (MalformedURLException e) {
				Log.e("DVP Gallery", "Erreur format URL : " + SERVER_IM+pht_mbl.getString(PwtProvider.M_ID_PARTAGE_URI_PHOTO_COLUMN));
				e.printStackTrace();
			}
			}while(pht_mbl.moveToNext());
		//}
		}
		Log.i("DVP Gallery", "URL : " + listFic.size());
		return listFic;
	}
 
	public void onBackPressed()   
	{  
		Etape etp = new Etape();
		ContentResolver cr = getContentResolver();
		cr.delete(PwtProvider.CONTENT_URI_PARTAGES, null, null);
		Intent intent = new Intent(Affichage.this, Visuetape.class);
		intent.putExtra("Visuel etape",(Parcelable)etp);
		intent.putExtra ("id voyage", id_vyg);
		intent.putExtra ("id user", id_users);
		intent.putExtra ("id etape", id_etps);
		intent.putExtra ("renvoie", envoi);
		startActivity(intent);
	}
 
	/**
         * Notre adapter qui gère la liste des vignettes
         * @author Mickaël Le Trocquer
         */
	public class AddImgAdp extends BaseAdapter {
		int GalItemBg;
		private Context cont;
 
		public AddImgAdp(Context c) {
			cont = c;
			TypedArray typArray = obtainStyledAttributes(R.styleable.GalleryTheme);
			GalItemBg = typArray.getResourceId(R.styleable.GalleryTheme_android_galleryItemBackground, 0);
			//typArray.recycle();
		}
 
		public int getCount() {
			return mListImages.size();
		}
 
		public Object getItem(int position) {
			return position;
		}
 
		public long getItemId(int position) {
			return position;
		}
 
 
 
		@Override
		public View getView(final int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			ImageView imgView = null;
			//Récyclage du composant
			if (convertView == null) {
				imgView = new ImageView(cont);
			} else {
				imgView = (ImageView)convertView;
			}
			//On affecte notre image à la vignette
			if (mListImages.size() <= 0) {
				imgView.setImageDrawable(mNoImage); 
			} else {
				setImage(imgView, mListImages.get(position));
			}
			//On défini la taille de l'image
			imgView.setLayoutParams(new Gallery.LayoutParams(150, 150));
			imgView.setScaleType(ImageView.ScaleType.FIT_XY);
			//On fixe un arrière plan plus sympa
			imgView.setBackgroundResource(GalItemBg);
			return null;
		}
	}
 
}
Et quand je charge les photos il me fait les erreurs suivantes:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
java.lang.nullpointerException
Merci à vous.

Loïc