Erreur ListFragment avec adapter customiser
Bonjour,
J'ai un petit souci lors que je fait appel a mon adapter depuis un ListFragment je vous donne le code de mon adapter :
Code:
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
|
public class ListingAdapter extends BaseAdapter {
private ArrayList<HashMap<String, String>> data;
Context context;
public ListingAdapter(Context a, ArrayList<HashMap<String, String>> d) {
this.context = a;
this.data=d;
}
public int getCount() {
return data.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
Log.e("test","test");
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.list_item, null);
}
TextView title = (TextView)convertView.findViewById(R.id.title);
HashMap<String, String> sdata = new HashMap<String, String>();
sdata = data.get(position);
title.setText(sdata.get(Listes.Val_Titre));
return convertView;
}
} |
voici le code qui fait appel l'adapter depuis un ListFragment
Code:
1 2 3 4 5 6 7 8
|
public void onPostExecute(HashMap<String, String> result){
pDialog.dismiss();
ListingAdapter adapter = new ListingAdapter(getActivity(),List);
setListAdapter(adapter);
} |
le code d'erreur c'est Nullpointer
Je ne vois pas ou est le souci.
si quelqu'un a des infos je suis preneur :)
Merci d'avance