Bonjour à tous, j'aimerais remplir une Gallery avec des images depuis un flux JSON en asynchrone
pour faire j'utilise une Classe :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
 public class ImageAdapter extends BaseAdapter {
avec la methode


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
public View getView(int position, View convertView, ViewGroup parent) {
			final ImageView i = new ImageView(this.myContext);
			String url[] =new String[]{"http://www.anddev.org/images/tiny_tutheaders/weather_forecast.png","http://www.anddev.org/images/tiny_tutheaders/cellidtogeo.png"};
 
			new AsyncTask<String, Void, Bitmap>() {
 
 
				private Bitmap bm;
 
				@Override
				protected Bitmap doInBackground(String... urls) {
					/* Open a new URL and get the InputStream to load data from it. */
					URL aURL;
 
					try {
						aURL = new URL(urls[0]);
						Log.i("URL", urls[0]);
						URLConnection conn = aURL.openConnection();
						conn.connect();
						InputStream is = conn.getInputStream();
						/* Buffered is always good for a performance plus. */
						BufferedInputStream bis = new BufferedInputStream(is);
						/* Decode url-data to a bitmap. */
						bm = BitmapFactory.decodeStream(bis);
						bis.close();
						is.close();
					} catch (MalformedURLException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} catch (IOException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
 
					return bm;
				}
 
				@Override
				protected void onPostExecute(Bitmap result) {
					if (result != null) {
						Log.i("result", ""+result);
						i.setImageBitmap(result);
 
					}
				}
 
 
 
			}.execute(url);
 
 
			return i;
		}
en matiere de test pour essayer de remplir ma liste en asynchrone

Mais aucune image ne s'affiche ...
Merci de votre aide.