Bonjour
J'ai un petit problème pour passer une variable d une activité a une autre , celle ci n'affiche rien , je passe par une Listview
activité 1
activité 2
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 public void onItemClick(AdapterView<?> av, View v, int pos, long id) { // TODO Auto-generated method stub Toast.makeText(getActivity(), data.get(pos).get("Player"), Toast.LENGTH_SHORT).show(); if (pos==0) { Intent intent = new Intent(getActivity (). getApplicationContext (), test.class); intent.putExtra(data.get(pos).get("Player"), players); startActivity (intent); }
merci de votre aide
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 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); Intent intent = getIntent(); if (intent != null){ String player = ""; if (intent.hasExtra("Player")){ player = intent.getStringExtra("Player"); } TextView textView = findViewById(R.id.textView9); textView.setText(player); }
Partager