package lvjian.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Ex_03_12Activity extends Activity {

private Button button1;
private Button button2;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

button1 = (Button) findViewById(R.id.button1);
button2 = (Button) findViewById(R.id.button2);
button1.setOnClickListener(new Button.OnClickListener() {

@Override
public void onClick(View v) {
new AlertDialog.Builder(Ex_03_12Activity.this)
.setTitle(R.string.app_about)
.setMessage(R.string.app_about_ms)
.setPositiveButton(R.string.app_ok,
new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog,
int which) {
System.out.println("hao");

}
}).show();

}

});
button2.setOnClickListener(new Button.OnClickListener() {

@Override
public void onClick(View v) {
new AlertDialog.Builder(Ex_03_12Activity.this)
.setTitle(R.string.app_about)
.setMessage(R.string.app_cancel)
.setPositiveButton(R.string.app_ok,
new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog,
int which) {
finish();

}
}).show();

}

});
}
}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 6.1.5 GridView详解编辑
  2. Android图表应用分享
  3. Android Activity的四种加载模式
  4. Android中startService的使用及Service生
  5. 利用百度词典API和Volley网络库开发的and
  6. Android热修复(二):以DexClassLoader类加载
  7. Android EditText按下输入法软件的enter
  8. Android 跨进程通信(IPC)机制的探索与研究
  9. Android中使用lambda表达式
  10. Android中JNI高级应用 - 本地C代码中创建