Voilà mon soucis :
Je dois passer un paramètre entre activities en cours d'execution. J'ai testé ça:
dans la première:
dans la deuxième:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 Intent player = new Intent(getApplicationContext(),HappyPlayer.class); player.putExtra("idAlbum", album.getId()); player.putExtra("idSong", id); startActivity(player); finish();
Seulement, la valeur est à null ...
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 @Override protected void onResume() { super.onResume(); Bundle objetbunble = this.getIntent().getExtras(); if (objetbunble != null && objetbunble.containsKey("idSong")) { long idSong = objetbunble.getLong("idSong"); for (Song song : tabSongs) if(song.getId()==idSong) this.currentSong = song; lancerTitre(); notifierTitre(this.currentSong.getTitre(),this.currentSong.getArtiste()); ((TextView)findViewById(R.id.tv_artist)).setText(this.currentSong.toString()); } }
Comment puis-je obtenir ce résultat ?
Partager