검색결과 리스트
알럿에 해당되는 글 1건
- 2012.02.11 [Android].java Alert Dialog - 알럿 다이얼로그 기본 팝업
글
import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast; public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final CharSequence[] color = {"Red", "Orange", "Yellow", "Green", "Blue", "Navy", "Purple"}; Button dialogBtn = (Button) findViewById(R.id.dialog); dialogBtn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { AlertDialog.Builder alertDialog = new AlertDialog.Builder( MainActivity.this); alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Log.i(getResources().getString( R.string.app_name), "OK"); } }); alertDialog.setNegativeButton("CANCEL", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Log.i(getResources().getString( R.string.app_name), "CANCEL"); } }); alertDialog.setSingleChoiceItems(color, 0, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); alertDialog.setTitle("alert"); alertDialog.show(); } }); } }
'프로그래밍 > ㆍAndroid' 카테고리의 다른 글
[Android] 입력 URL에 따른 웹문서 소스보기 - 간단한 입력 URL에 따른 웹소스 (0) | 2012.02.12 |
---|---|
[Android].java .xml Alert Dialog 알럿 다이얼로그 응용 예제 (0) | 2012.02.11 |
[Android].xml Permission 사용하기 - 통신 관련 (0) | 2012.02.11 |
[Android].class XMLManager - xml에서 파싱 목적 (0) | 2012.02.10 |
RECENT COMMENT