본문 바로가기
개발을하자/Mobile

#커스텀다이얼로그# 띄워봅시다!

by _ssu 2015. 6. 2.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Context mContext = getApplicationContext();
            LayoutInflater inflater = (LayoutInflater) mContext
                    .getSystemService(LAYOUT_INFLATER_SERVICE);
            View layout = inflater.inflate(R.layout.activity_send_user_message,
                    (ViewGroup) findViewById(R.id.layout_root));
 
            AlertDialog.Builder aDialog = new AlertDialog.Builder(
                    CRSMainActivity.this);
            aDialog.setTitle(sendUserID + "님에게 메시지 전송");
            aDialog.setView(layout);
 
            message = (EditText) layout.findViewById(R.id.sendMessage);
 
            aDialog.setPositiveButton("전송",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            sendMessageStr = message.getText().toString();
                            try {
                                SocketManager.SendMessage("SNUR"
                                        + sendMessageStr + "/" + sendUserID
                                        "/");
                            catch (IOException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }
                            Log.e("메시지 전송", sendMessageStr);
                        }
                    });
            aDialog.setNegativeButton("취소",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                        }
                    });
            AlertDialog ad = aDialog.create();
            ad.show();


'개발을하자 > Mobile' 카테고리의 다른 글

#Android# UI 라이브러리 모음  (0) 2015.10.29

댓글