Bonjour, je débute en Java et malgré plusieurs essais je n'arrive pas a trouver le bon code pour ouvrir une activité a partir d'un Item d'une List view.

j'ai reussi à creer la list view et les item mais quand je n'arrive pas à ouvrir l'activité alertes quand je clique sur le 1er item de la liste.

Si quelqu'un pouvait m'aider

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
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
 
import android.os.Bundle;
import android.app.Activity;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
 
 
 
public class AlertesActivity extends Activity implements OnClickListener {
 
    Map<String, Integer> mapIndex;
    ListView alerteList;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_alertes);
 
        String[] alertes = getResources().getStringArray(R.array.alertes_array);
 
        Arrays.asList(alertes);
 
        alerteList = (ListView) findViewById(R.id.list_alertes);
        alerteList.setAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, alertes));
 
        getIndexList(alertes);
 
        displayIndex();
 
    }
 
    private void getIndexList(String[] alertes) {
        mapIndex = new LinkedHashMap<String, Integer>();
        for (int i = 0; i < alertes.length; i++) {
            String alerte = alertes[i];
            String index = alerte.substring(0, 1);
 
            if (mapIndex.get(index) == null)
                mapIndex.put(index, i);
        }
    }
 
    private void displayIndex() {
        LinearLayout indexLayout = (LinearLayout) findViewById(R.id.side_index);
 
        TextView textView;
        List<String> indexList = new ArrayList<String>(mapIndex.keySet());
        for (String index : indexList) {
            textView = (TextView) getLayoutInflater().inflate(
                    R.layout.side_index_item, null);
            textView.setText(index);
            textView.setOnClickListener(this);
            indexLayout.addView(textView);
        }
    }
 
 
}