package com.popup.demo;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
public class ShowCustomDialog extends Activity implements View.OnClickListener{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.customdialog);
Button btnCustomDialog = (Button)findViewById(R.id.Button01);
Button btnCustomAlertDialog = (Button)findViewById(R.id.Button02);
btnCustomDialog.setOnClickListener(this);
btnCustomAlertDialog.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId())
{
case R.id.Button01:
Dialog dialog1 = new Dialog(ShowCustomDialog.this);
dialog1.setContentView(R.layout.dialog1);
dialog1.setTitle("This is my custom dialog box");
dialog1.show();
break;
case R.id.Button02:
final Dialog dialog = new Dialog(ShowCustomDialog.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog2);
//dialog.setTitle("This is my custom dialog box");
dialog.show();
Button btnSms = (Button)dialog.findViewById(R.id.btnSms);
btnSms.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Uri uri = Uri.parse("smsto://13057602765");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra("sms_body", "The SMS text");
startActivity(intent);
}
});
Button btnCall = (Button)dialog.findViewById(R.id.btnCall);
btnCall.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Uri uri = Uri.parse("tel:13057602765");
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
startActivity(intent);
dialog.dismiss();
}
});
Button btnEmail = (Button)dialog.findViewById(R.id.btnEmail);
btnEmail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Uri uri = Uri.parse("mailto:test@gmail.com");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
startActivity(intent);
dialog.dismiss();
}
});
break;
default:
break;
}
}
}
android之popwindow的DEMO
5星 · 超过95%的资源 需积分: 15 180 浏览量
2014-05-05
17:10:48
上传
评论 3
收藏 1.27MB RAR 举报
Wei_Leng
- 粉丝: 1105
- 资源: 45
最新资源
- 基于matlab实现配电网三相潮流计算方法,对几种常用的配电网潮流计算方法进行了对比分析.rar
- 基于matlab实现配电网潮流 经典33节点 前推回代法潮流计算 回代电流 前推电压 带注释.rar
- 基于matlab实现模拟退火遗传算法的车辆调度问题研究,用MATLAB语言加以实现.rar
- 基于matlab实现蒙特卡洛的的移动传感器节点定位算法仿真代码.rar
- 华中数控系统818用户说明书
- 基于matlab实现卡尔曼滤波器完成多传感器数据融合 对多个机器人的不同传感器数据进行融合估计足球精确位置.rar
- 基于matlab实现进行简单车辆识别-车辆检测.rar
- 基于JSP物流信息网的设计与实现
- 基于matlab实现车牌识别程序,和论文,自己做的,做毕业设计的可以看看 .rar
- Windows系统下安装与配置Neo4j的步骤
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
- 4
- 5
前往页