package kr.ac.dju.android.test
import android.app.Activity;
import android.content.Intent;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ToggleButton;
public class Activitytest extends Activity {
private static SoundPool soundPool;
private static int[] sound;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test);
Intent intent = getIntent();
Button airButton = (Button) findViewById(R.id.firstviewAirbutton);
airButton.setOnClickListener(new OnClickListener() {
ToggleButton tg= (ToggleButton) findViewById(R.id.Toggle);
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(Activitytestthis,Activitytest1.class);
startActivity(intent);
tg.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
soundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0 );
sound = new int[1];
sound[0] = soundPool.load(this, R.raw.sound, 1);
}
});
}
});
}
public static void playSound(int i){
soundPool.play( sound[i], 1, 1, 0, 0, 1);
}
}
-------------------------------------------------------------------
sound[0] = soundPool.load(this, R.raw.sound, 1);
요기 load에서 에러가 뜨는데 어떻게 해결해야하죠?
답답합니다. 도와주세요.ㅠ.ㅜ