This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final CharSequence[] items = {"Red", "Green", "Blue"}; | |
| AlertDialog.Builder builder = new AlertDialog.Builder(this); | |
| builder.setTitle("리스트 타이틀"); | |
| builder.setSingleChoiceItems(items, -1, | |
| new DialogInterface.OnClickListener() { | |
| public void onClick(DialogInterface dialog, int item) { | |
| Toast.makeText(getApplicationContext(), items[item], | |
| Toast.LENGTH_SHORT).show(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ProgressDialog dialog = ProgressDialog.show(AndroidTest.this, "", | |
| "로딩 중입니다. 잠시 기다려주세요", true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ProgressDialog dialog = ProgressDialog.show(AndroidTest.this, "", | |
| "로딩 중입니다. 잠시 기다려주세요", true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ProgressDialog progressDialog; | |
| progressDialog = new ProgressDialog(AndroidTest.this); | |
| progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); | |
| progressDialog.setMessage("로딩중입니다..."); | |
| progressDialog.setCancelable(false); | |
| progressDialog.show(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package exam.androidtest; | |
| import android.app.Activity; | |
| import android.app.Dialog; | |
| import android.app.ProgressDialog; | |
| import android.os.Bundle; | |
| import android.os.Handler; | |
| import android.os.Message; | |
| import android.view.View; | |
| import android.view.View.OnClickListener; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:id="@+id/layout_root" | |
| android:orientation="horizontal" | |
| android:layout_width="fill_parent" | |
| android:layout_height="fill_parent" | |
| android:padding="10dp" | |
| > | |
| <ImageView android:id="@+id/image" | |
| android:layout_width="wrap_content" | |
| android:layout_height="fill_parent" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Context mContext = getApplicationContext(); | |
| Dialog dialog = new Dialog(mContext); | |
| dialog.setContentView(R.layout.custom_dialog); | |
| dialog.setTitle("커스텀 다이얼로그"); | |
| TextView text = (TextView) dialog.findViewById(R.id.text); | |
| text.setText("Hello, this is a custom dialog!"); | |
| ImageView image = (ImageView) dialog.findViewById(R.id.image); | |
| image.setImageResource(R.drawable.icon); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AlertDialog.Builder builder; | |
| AlertDialog alertDialog; | |
| Context mContext = getApplicationContext(); | |
| LayoutInflater inflater | |
| = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER); | |
| View layout = inflater.inflate(R.layout.custom_dialog, | |
| (ViewGroup) findViewById(R.id.layout_root)); | |
| TextView text = (TextView) layout.findViewById(R.id.text); | |
| text.setText(“Hello, this is a custom dialog!”); | |
| ImageView image = (ImageView) layout.findViewById(R.id.image); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AlertDialog.Builder builder; | |
| AlertDialog alertDialog; | |
| Context mContext = getApplicationContext(); | |
| LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE); | |
| View layout = inflater.inflate(R.layout.custom_dialog, | |
| (ViewGroup) findViewById(R.id.layout_root)); | |
| TextView text = (TextView) layout.findViewById(R.id.text); | |
| text.setText("커스텀 다이얼로그..."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 버튼을 만들고 | |
| btn = (Button)findViewById(R.id.btn); | |
| // OnClickListener 를 만들고 구현. | |
| btn.setOnClickListener(new View.OnClickListener() { | |
| public void onClick(View v) { | |
| // 버튼 클릭시 일어날 작업 처리. | |
| } | |
| }); |