아틴
Atin
아틴
전체 방문자
오늘
어제
  • 분류 전체보기 (460)
    • Devlopment (246)
      • 정리 글 (20)
      • MicroServices (0)
      • Reactive, Concurrenc.. (12)
      • Java (44)
      • Spring (20)
      • C,C++,Ruby,Python (52)
      • Mobile (39)
      • Web (35)
      • Tip & Info (14)
      • Unit Test (7)
    • Infra (44)
      • OS (21)
      • RDBMS (13)
      • NoSQL&Cache (5)
      • AWS (4)
    • Computer Science (11)
    • Etc (156)

블로그 메뉴

  • Home
  • Guestbook

공지사항

인기 글

태그

  • 아이폰
  • C
  • CSS
  • Dungeons & Dragons
  • 여행
  • 안드로이드
  • Python
  • 던젼 앤 드래곤즈
  • 자바
  • javascript
  • TRPG
  • Android
  • Java
  • 전라도
  • 해킨토시
  • Ruby on Rails
  • 정읍
  • mysql
  • Linux
  • jsp

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
아틴

Atin

[Android] 알림 - AlertDialog, Toast
Devlopment/Mobile

[Android] 알림 - AlertDialog, Toast

2011. 6. 27. 13:55
반응형
AlertDialog를 이용하면 알림과 버튼을 제공하고 Toast를 이용하면 메시지를 사용자에게 전달해줄 수 있다.

1. Toast 

Toast.makeText(PersonalActivity.this, "Message", Toast.LENGTH_LONG).show();




2. AlertDialog 

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Title");
builder.setMessage("Message");
builder.setNegativeButton("NegativeButton", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 
}
});
builder.setNeutralButton("NeutralButton", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 
}
});
builder.setPositiveButton("PositiveButton", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 
}
});
builder.show();

AlertDialog의 경우에는 최대 3개의 버튼을 제공하는데 각 버튼은 같은 기능을 제공하며 차이점은 위치뿐이다.
Negative - 왼쪽, Neutral - 가운데, Positive - 오른쪽


 
 
반응형

'Devlopment > Mobile' 카테고리의 다른 글

java.io.IOException: Unable to open sync connection! 해결법  (6) 2011.07.12
ListView 스크롤시 검은색 배경으로 바뀌는 문제  (0) 2011.07.12
안드로이드 GPS 위치 수신  (0) 2011.07.12
Android 타이틀 바 관련.  (0) 2011.07.11
안드로이드 ListView구현시 Adapter의 getView 중복 호출 문제  (0) 2011.07.11
모바일상에서의 Network Programming  (1) 2011.06.23
Android Sensor 활용  (0) 2011.06.22
Android 진동 다루기  (0) 2011.06.22
Android Camera  (0) 2011.06.22
Android Drawing  (0) 2011.06.21
    'Devlopment/Mobile' 카테고리의 다른 글
    • Android 타이틀 바 관련.
    • 안드로이드 ListView구현시 Adapter의 getView 중복 호출 문제
    • 모바일상에서의 Network Programming
    • Android Sensor 활용
    아틴
    아틴

    티스토리툴바