Issue
The program works fine when I delete out the onResume() method but when I leave it in the program starts normally with the music playing yet nothing is displayed on my screen, and then when I try exiting out it freezes and takes a minute for the phone to come out of being frozen. What is wrong with this onResume() method? Do you need to see all of my code? Why would this happen?
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
int spot = settings.getInt("point", 0);
try {
music.get(track).prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
music.get(track).seekTo(spot);
music.get(track).start();
}
And here is the onCreate()
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
song0 = MediaPlayer
.create(TheParty0Activity.this, R.raw.blacksunempire);
song1 = MediaPlayer.create(TheParty0Activity.this, R.raw.blueskies);
song2 = MediaPlayer.create(TheParty0Activity.this, R.raw.fuckingnoise);
music.add(song0);
music.add(song1);
music.add(song2);
music.get(track).start();
// box = (TextView) findViewById(R.id.editText1);
// play = (Button) findViewById(R.id.button0);
next = (Button) findViewById(R.id.button1);
// extra = (Button) findViewById(R.id.button2);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
music.get(track).stop();
track++;
if (track == 3) {
for (int i = 0; i < 3; i++) {
try {
music.get(i).prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
music.get(i).seekTo(0);
}
track = 0;
}
music.get(track).start();
}
});
extra.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent ourIntent = new Intent(TheParty0Activity.this, Sam.class);
startActivity(ourIntent);
}
});
}
Solution
Nevermind neither of these methods were the problem
Answered By - Bob Smith
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.