Bonsoir,
J' ai développé ce programme qui permet de gérer une catalogue !
Le programme doit afficher la liste des catégorie des produits
qui sont dans une base de données mysql, via php et mysql et json.
Et lorsque les catégories et leurs images seront affichés, si on clique
sur une catégorie, on verra les détails d une catégorie . Mais
j' ai fini, ça a récupéré les données sur la base des données, mais
ça n affiche rien ! AIDEZ MOI A DÉBOGUER SVP

VOICI LE CODE
Code Java : 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
 
package km.synapse.catalogue.model;
 
import java.io.InputStream;
import java.net.URL;
import java.util.List;
 
import km.synapse.catalogue.MainActivity;
import km.synapse.catalogue.R;
 
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
 
public class ListCatModel extends ArrayAdapter<Categorie> {
 
	private List<Categorie> categories;
 
	public ListCatModel(Context context, int textViewResourceId,List<Categorie>cats) {
		super(context, textViewResourceId,cats);
		this.categories=cats;
	}
     @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
    	LayoutInflater inflater = (LayoutInflater)
    	getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    	  View rowView = inflater.inflate(R.layout.cat_item,parent );
    	  TextView textView =(TextView) rowView.findViewById(R.id.textViewCat);
    	  final ImageView imageView =(ImageView) rowView.findViewById(R.id.imageViewCat);
    	  textView.setText(categories.get(position).getNomCategorie());
    	  textView.setText(categories.get(position).getNomCategorie());
    	  new Thread(new Runnable() {
 
			@Override
			public void run() {
				try{
				String nomImage =categories.get(position).getPhotoCat();	
				InputStream is = new URL(MainActivity.url+"/Catalogue/images"+nomImage).openStream();
				Bitmap bitmap = BitmapFactory.decodeStream(is);
				imageView.setImageBitmap(bitmap);
 
 
				}
				 catch(Exception e){
					 e.getMessage();
				 }
 
			}
		}).start();
    	return rowView;
    }
}

--------------------------CLASS CATEGORIE--------------------------------
Code Java : 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
package km.synapse.catalogue.model;
 
import java.io.Serializable;
 
import com.google.gson.annotations.SerializedName;
 
public class Categorie implements Serializable{
	@SerializedName ("id_cat")
	private Long idCategorie;
	@SerializedName ("nomCat")
	private String nomCategorie;
	@SerializedName ("description")
	private String descrition;
	@SerializedName ("photo")
	private String photoCat;
	public Categorie(Long idCategorie, String nomCategorie, String descrition,
			String photoCat) {
		super();
		this.idCategorie = idCategorie;
		this.nomCategorie = nomCategorie;
		this.descrition = descrition;
		this.photoCat = photoCat;
	}
	public Categorie() {
		super();
		// TODO Auto-generated constructor stub
	}
	public Long getIdCategorie() {
		return idCategorie;
	}
	public void setIdCategorie(Long idCategorie) {
		this.idCategorie = idCategorie;
	}
	public String getNomCategorie() {
		return nomCategorie;
	}
	public void setNomCategorie(String nomCategorie) {
		this.nomCategorie = nomCategorie;
	}
	public String getDescrition() {
		return descrition;
	}
	public void setDescrition(String descrition) {
		this.descrition = descrition;
	}
	public String getPhotoCat() {
		return photoCat;
	}
	public void setPhotoCat(String photoCat) {
		this.photoCat = photoCat;
	}
 
}