我想播放所选专辑中的一首歌。 问题是每当我点击一张专辑,选择歌曲时,playSong方法当然会播放第一首歌,因为代码第2部分(向下)。也许你看看我的代码,你可以帮助我。谢谢你很多,Vinzenz
第1部分:
.
.
.
public void playSong(int songIndex){
// Play song
try {
mp.reset();
mp.setDataSource(songsList.get(songIndex).get("songPath"));
mp.prepare();
mp.start();
// Displaying Song title
String songTitle = songsList.get(songIndex).get("songTitle");
songTitleLabel.setText(songTitle);
.
.
.
第2部分:
.
.
.
public void onItemClick(AdapterView<?> a, View v, int position, long Title ) {
if (cursor.moveToPosition(position)) {
// getting listitem index
int songIndex = position;
// Starting new intent
Intent in = new Intent();
// Sending songIndex to BrowseActivity
in.putExtra("songIndex", songIndex);
setResult(100, in);
// Closing PlayListView
finish();
}
.
.
.