Bonjour,
je veux afficher le contenu d'une "arraylist" çàd liste des produits cochés qui j'ai nommée selectedProduct dans une autre activité , ma liste final des produits cochés dans une activité

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
 
 
public class ProductList extends Activity {
 
	private SettingsListAdapter adapter;
	private ExpandableListView categoriesList;
	private ArrayList<Category> categories;
	private ArrayList<String> selectedProduct;
 
 
	protected Context mContext;
	Category category;
 
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.productlistlayout);
		mContext = this;
 
		Button button = (Button) findViewById(R.id.Listfinal);
 
		selectedProduct = new ArrayList<>();
		categoriesList = (ExpandableListView)findViewById(R.id.categories);
		ArrayList<String> stringArrayList = getIntent().getStringArrayListExtra("SELECTED_LETTER");
 
		categories = Category.getCategories(stringArrayList);
		adapter = new SettingsListAdapter(this, 
				categories, categoriesList);
        categoriesList.setAdapter(adapter);
 
        categoriesList.setOnChildClickListener(new OnChildClickListener() {
 
			@Override
			public boolean onChildClick(ExpandableListView parent, View v,
                                        int groupPosition, int childPosition, long id) {
 
 
				CheckedTextView checkbox = (CheckedTextView)v.findViewById(R.id.list_item_text_child);
				checkbox.toggle();
 
 
				// find parent view by tag
				View parentView = categoriesList.findViewWithTag(categories.get(groupPosition).name);
				if(parentView != null) {
					TextView sub = (TextView)parentView.findViewById(R.id.list_item_text_subscriptions);
 
					if(sub != null) {
						category = categories.get(groupPosition);
						if(checkbox.isChecked()) {
							// add child category to parent's selection list
							category.selection.add(checkbox.getText().toString());
							selectedProduct.add(checkbox.getText().toString());
 
							// sort list in alphabetical order
							Collections.sort(category.selection, new CustomComparator());
						}
						else {
							// remove child category from parent's selection list
							category.selection.remove(checkbox.getText().toString());
							selectedProduct.remove(checkbox.getText().toString());
						}
 
						// display selection list
					//	sub.setText(selectedProduct.toString());
					}
				}				
				return true;
			}
		});
 
		button.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				// Do something in response to button click
				Intent intent = new Intent(ProductList.this, ListselectedProduct.class);
				intent.putStringArrayListExtra("SELECTED_LETTER",selectedProduct );
				startActivity(intent);
			}
		});
	}
 
 
 
	public class CustomComparator implements Comparator<String> {
        @Override
        public int compare(String o1, String o2) {
            return o1.compareTo(o2);
        }
    }
 
}
J'ai utilisé Get ArrayList mais ca fonctionne pas quelqu'un peut m'aider comment je puisse recuperer ,
j'ai créer une activité avec listView et .xml comme ci_dessous:
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
 
public class ListselectedProduct extends Activity {
 
    ArrayList<String> mListView;
 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listselectedproduct);
      /* mListView = (ListView) findViewById(R.id.listview);
//
 
        Bundle b    = getIntent().getExtras();
        mListView = b.getStringArrayList("selectedProduct");
        //      selectedProduct mListView = b.getParcelable("selectedProduct");
        //ArrayList<String> stringArrayList = getIntent().getStringArrayListExtra("SELECTED_LETTER");
 
      //  mListView getselectedProduct;*/
 
    }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
 
    <ListView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/listview">
 
    </ListView>
 
</RelativeLayout>