Bonjour a la communauté je fait ce post en n ayant pas trouve de réponse sur mon problème de variable voila mon problème. J ai trouvé un script mais j ai un petit problème j ai userlistadapter qui récupère les info d une class book cela me permet d afficher un listview quand je clic sur le nom du produit je sais ouvrir l activité en fonction du produit par contre ma fiche produit ne me retourne pas le nom dans le titre malgré le tag

je vous met les deux class merci a vous pour vos idées car j ai du mal sur les string


mon userlistadapter qui recupere mes produits de ma class book
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
 
 
public class UserListAdapter extends BaseAdapter implements OnClickListener  {
 
	private static final String TAG = UserListAdapter.class.getName();
	private Activity activity;
	private Vector<Book> items;
	private Context mContext;
 
 
	ImageButton retour;
 
 
 
 
 
	public UserListAdapter(Activity activity, Vector<Book> items) {
		Log.i(TAG, TAG);
		this.activity = activity;
		this.items = items;
 
 
	}
 
	public View getView(final int position, View convertView, ViewGroup parent) {
 
 
		ViewHolder holder;
 
		if (convertView == null) {
 
 
 
			LayoutInflater inflater = activity.getLayoutInflater();
			convertView = inflater.inflate(R.layout.listrow_user, null);
 
			holder = new ViewHolder();
 
			holder.name = (TextView) convertView.findViewById(R.id.nameTV);
			holder.headingLL = (LinearLayout) convertView
					.findViewById(R.id.headingLL);
			holder.headingTV = (TextView) convertView
					.findViewById(R.id.headingTV);
			holder.nameLL = (LinearLayout) convertView
					.findViewById(R.id.nameLL);
 
			convertView.setTag(holder);
 
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
 
		if (position < items.size()) {
 
			final Book book = items.get(position);
			if (book != null && (book.getProduits().length() == 1)) {
				holder.nameLL.setVisibility(View.GONE);
				holder.headingLL.setVisibility(View.VISIBLE);
				holder.headingTV.setText(book.getProduits());
				holder.headingLL
						.setBackgroundColor(android.R.color.transparent);
			} else {
				holder.nameLL.setVisibility(View.VISIBLE);
				holder.headingLL.setVisibility(View.GONE);
				holder.name.setText(book.getProduits());
 
				View ll = (LinearLayout) holder.name.getParent();
				ll.setFocusable(true);
				ll.setSelected(true);
				ll.setOnClickListener(new OnClickListener() {
 
					public void onClick(View v) {
						/* action sur le clic */
 
 
 
						if (book.getListe().equals("A")  ) {
 
							Toast.makeText(activity.getApplicationContext(),
									"produit liste A",
									Toast.LENGTH_SHORT).show();
							Intent menuIntent = new Intent(activity,MenuproduitsInterventionA.class);
							menuIntent.putExtra("produits",book.getProduits().toString() );
 
							activity.startActivity(menuIntent);
							finish();
 
 
 
						}
 
						else if (book.getListe().equals("B")) {
 
							Toast.makeText(activity.getApplicationContext(),
									"produit liste B",
									Toast.LENGTH_SHORT).show();
							Intent menuIntent = new Intent(activity,MenuproduitsInterventionB.class);
							activity. startActivityForResult(menuIntent, position);
							finish();
 
 
 
 
						} else if (book.getListe().equals("C")) {
 
							Toast.makeText(activity.getApplicationContext(),
									"Vous avez cliquez sur produit liste C",
									Toast.LENGTH_SHORT).show();
							Intent menuIntent = new Intent(activity,MenuproduitsInterventionC.class);
							activity.startActivity(menuIntent);
							finish();
 
 
						}
 
					}
 
					private Context getApplication() {
						// TODO Auto-generated method stub
						return null;
					}
 
					private Context getBaseContext() {
						// TODO Auto-generated method stub
						return null;
					}
 
					private void startActivity(Intent menuIntent) {
						// TODO Auto-generated method stub
 
					}
				});
			}
		}
 
		return convertView;
	}
 
 
 
 
 
 
	protected void finish() {
		// TODO Auto-generated method stub
 
	}
 
	private static class ViewHolder {
		TextView name, headingTV;
		LinearLayout nameLL, headingLL;
	}
 
	@Override
	public int getCount() {
		return items.size();
	}
 
	@Override
	public Object getItem(int position) {
		return items.get(position);
	}
 
	@Override
	public long getItemId(int position) {
		return position;
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
 
	}
 
 
 
 
 
 
}

et mon activité qui dois recuperer mon nom dans le titre

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


	TextView titre;
	private static final String TAG =UserListAdapter.class.getName();
	private Activity activity;
	private Vector<Book> items;
	private Context mContext;

	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.menu_scenario_a);
		
		// gestion bouton dans la barre accueil include layout
		LinearLayout monInclude = (LinearLayout) findViewById(R.id.include1);
		retour=(ImageButton)monInclude.findViewById(R.id.imageButtonRetour);
		retour.setOnClickListener(this);

		

		// gestion bouton dans le layout principal
		bleve = (Button) findViewById(R.id.Boutonbleve);
		bleve.setOnClickListener(this);// ecoute du bouton sur un clic
		titre=(TextView)findViewById(R.id.textView1);
		titre.setText(TAG); Ici le pb j affiche pas le nom du produit

		uvce=(Button)findViewById(R.id.Boutonuvce);
		uvce.setOnClickListener(this);
		



}
voila j espère avoir été clair merci a vous je suis néophyte