Passage de paramètres entre activities ?
Voilà mon soucis :
Je dois passer un paramètre entre activities en cours d'execution. J'ai testé ça:
dans la première:
Code:
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(); |
dans la deuxième:
Code:
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());
}
} |
Seulement, la valeur est à null ...
Comment puis-je obtenir ce résultat ?