package com.jerry;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
public class Jerry_Dialog extends JerryActivity
{
ProgressDialog m_Dialog;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.jerry_dialog_bg);
// jin
AlertDialog.Builder outbuilder = new AlertDialog.Builder(Jerry_Dialog.this);
outbuilder.setTitle("登陆提示");
outbuilder.setMessage("这里需要登录!");
outbuilder.setPositiveButton("确定", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
// TODO Auto-generated method stub
Log.v("jin", "确定按钮");
LayoutInflater factory = LayoutInflater.from(Jerry_Dialog.this);
final View DialogView = factory.inflate(R.layout.jerry_dialog_bg, null);// 得到自定义对话框
AlertDialog.Builder innerBuilder = new AlertDialog.Builder(Jerry_Dialog.this);
innerBuilder.setTitle("登陆中....jerry.");
innerBuilder.setView(DialogView);// 设置自定义对话框的样式
innerBuilder.setPositiveButton("确定", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
// TODO Auto-generated method stub
//Log.v("jin", "--------not here--");
//m_Dialog = ProgressDialog.show(Jerry_Dialog.this, "请等等", "正在为你登陆。。。", true);
//new Thread()
//{
//public void run()
//{
//try
//{
//sleep(10000);
//} catch (Exception e)
//{
TODO: handle exception
//}
//finally{
登陆结束,取消对话框
m_Dialog.dismiss();
//}
//}
//}.start();
//
//testSingle();
testMukti();
/
}
});
//老是显示不出来,没有写这两句话
AlertDialog innerAlertDialog=innerBuilder.create();
innerAlertDialog.show();
}
});
outbuilder.setNegativeButton("取消", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
// 点击"取消"按钮之后退出jerry_dialog
Jerry_Dialog.this.finish();
}
});
outbuilder.setNeutralButton("退出", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
// TODO Auto-generated method stub
Jerry_Dialog.this.finish();
}
});
AlertDialog dialog = outbuilder.create();
dialog.show();
}
@Override
public String getName()
{
// TODO Auto-generated method stub
return null;
}
AlertDialog alertDialog;
/**
* 测试单选
*/
private void testSingle(){
AlertDialog.Builder builder00=new AlertDialog.Builder(this);
builder00.setTitle("jerry test");
//setMessage和setSingleChoiceItems不能并列使用
//builder00.setMessage("android dialog test");
builder00.setSingleChoiceItems(new String[]{"aa","bb","cc","dd","ee","ff"}, 0, new DialogInterface.OnClickListener()
{
//which 是单选的索引
//question dialog 这个参数如何获取?
public void onClick(DialogInterface dialog, int which)
{
// TODO Auto-generated method stub
if(dialog.equals(alertDialog)){
Log.v("jin", "=================");
}
Log.v("jin", "which="+which);
}
});
AlertDialog alertDialog=builder00.create();
alertDialog.show();
}
public void testMukti(){
AlertDialog.Builder builder00=new AlertDialog.Builder(this);
builder00.setTitle("jerry test");
//setMessage和setSingleChoiceItems、setMultiChoiceItems不能并列使用
//builder00.setMessage("android dialog test");
builder00.setMultiChoiceItems(new String[]{"aa","bb","cc","dd","ee","ff"}, new boolean[6], new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int which, boolean isChecked)
{
// TODO Auto-generated method stub
Log.v("jin", "which="+which+" "+"ischecked="+isChecked);
}
});
AlertDialog alertDialog=builder00.create();
alertDialog.show();
}
}