0
게임이 일시 중지 경고 대화 상자를 표시하고 잠시 후 화면 잠금을 자동으로 표시하면 "활동을 파괴 할 수 없습니다 (NullPointer)"오류가 발생합니다.alertdialog가 열리고 화면이 잠길 때 활동을 파괴 할 수 없습니다.
나는 비슷한 게시물을 읽고 있었지만 제대로 작동하지 않습니다. 여기
는 호출되는 방법 때 사용자를 눌러 다시 또는 메뉴 버튼 :private void showPauseDialog()
{
this.runOnUiThread(new Runnable() {
@Override
public void run() {
//Handler mHandler = new Handler();
MadhonActivity.this.mMusic.pause();
AlertDialog.Builder builder;
//AlertDialog alertDialog;
LayoutInflater inflater = (LayoutInflater) MadhonActivity.this.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.pause,(ViewGroup) getCurrentFocus());//findViewById(R.id.layout_root));
//TextView text = (TextView) layout.findViewById(R.id.stcomplete_score);
TextView text_0 = (TextView) layout.findViewById(R.id.pause_tv);
//text.setText("200");
Typeface font = Typeface.createFromAsset(getAssets(), "font/mvb2.ttf");
//text.setTypeface(font);
text_0.setTypeface(font);
ImageButton btnext = (ImageButton)layout.findViewById(R.id.pause__btnext);
builder = new AlertDialog.Builder(MadhonActivity.this);
builder.setView(layout);
final AlertDialog alertDialog = builder.create();
alertDialog.setCancelable(true);
btnext.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
alertDialog.dismiss();
MadhonActivity.this.mMusic.play();
}});
alertDialog.show();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
}
});
}
그리고 여기 내들의 OnDestroy 방법 :
protected void onDestroy()
{
madhon_ko.stop(); //sound
mMusic.stop(); //sound
super.onDestroy();
}
어떤 도움?