gpt4 book ai didi

android - 为什么这会使我的屏幕消失并导致手机崩溃?

转载 作者:行者123 更新时间:2023-12-03 17:40:23 26 4
gpt4 key购买 nike

当我删除onResume()方法时,该程序运行良好,但是当我将其保留在程序中时,通常会随着音乐播放而启动,但屏幕上却没有任何显示,然后当我尝试退出时,它冻结并花了一分钟手机从被冻结出来。此onResume()方法有什么问题?您需要查看我的所有代码吗?为什么会这样?

@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();
}

这是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);
}
});


}

最佳答案

没关系,这些方法都不是问题

关于android - 为什么这会使我的屏幕消失并导致手机崩溃?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12066591/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com