-2

onItemClick を使用し、if 条件で文字列配列を raw フォルダーの MP3 ファイルと一致させます リストビューの曲をクリックして、その mplay メソッドだけを呼び出して他のアクティビティで曲を再生する必要があります。助けてください....

public void onItemClick(AdapterView<?> parent, View view, int position,long id) 
{     
    Intent intent = new Intent(this, Play.class);
    startActivity(intent);

    MediaPlayer mPlayer2;
    MediaPlayer mPlayer3;




    if(position==0)
    {
        public void mplay() **<--------- I Get error in this Line**
                    {
        mPlayer2= MediaPlayer.create(this, R.raw.gayatri);
        mPlayer2.start();
                    }

    }
4

3 に答える 3