input_text.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Context ctx = getApplicationContext();
LayoutInflater inflater = (LayoutInflater)ctx.getSystemService(LAYOUT_INFLATER_SERVICE);
final View layout = inflater.inflate(R.layout.text,null);
AlertDialog.Builder aDialog = new AlertDialog.Builder(MainActivity.this);
aDialog.setTitle("텍스트를 입력해주세요?");
aDialog.setView(layout);
aDialog.setPositiveButton("확인",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
EditText t = (EditText)layout.findViewById(R.id.image);
String str = t.getText().toString();
Paper.str = str;
Paper.draw_text = true;
Paper.check_text = true;
Paper.clear_check = false;
Paper.make_point = false;
Paper.erase = false;
}
});
aDialog.setNegativeButton("취소",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
}
});
AlertDialog ad = aDialog.create();
ad.show();
}
});
버튼 클릭 시 dialog 를 생성해서 확인버튼을 누르면 Paper 클래스 변수에 문자열을 저장하려고하는데요,
Paper.str = "텍스트입니다"; 이렇게 문자열을 지정해서 하면 제대로 결과가 나오는데
Paper.str = edittext.gettext().toString(); 을 하면 null 이 저장되는 것 같습니다.