다른건 곧잘 되는데 커스텀 다이얼 로그만 띄우면 응답없음이 나오는데.. 혹시 이런 경험 해보신분 경험담이나 해결방법좀 알려주세요.
소스는 별거 없고 참고로 보시면
package android.sample;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class CustomDialogTest extends Activity {
/** Called when the activity is first created. */
static final int CUSTOM_DIALOG1 = 0;
static final int CUSTOM_DIALOG2 = 1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button button = (Button) findViewById(R.id.Button01);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//showDialog(CUSTOM_DIALOG1);
showDialog(CUSTOM_DIALOG2);
}
});
}
protected Dialog onCreateDialog(int id) {
switch(id) {
//그냥 생성
case CUSTOM_DIALOG1:
Dialog dialog = new Dialog(CustomDialogTest.this);
dialog.setContentView(R.layout.custom_dialog);
dialog.setTitle("Custom Dialog");
return dialog;
//얼럿다이얼로그로 생성
case CUSTOM_DIALOG2:
LayoutInflater inflater = (LayoutInflater)
this.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custom_dialog,
(ViewGroup) findViewById(R.id.layout_root));
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(layout);
return builder.create();
default:
return null;
}
}
}