首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

容易列表对话框继承自android.app.AlertDialog.Builder

2012-09-03 
简单列表对话框继承自android.app.AlertDialog.Builder1、效果图:???????????????????????????????????2、核

简单列表对话框继承自android.app.AlertDialog.Builder

1、效果图:

?

?

容易列表对话框继承自android.app.AlertDialog.Builder

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

2、核心代码:

?

package com.pop.app.mas;import android.app.Activity;import android.app.AlertDialog.Builder;import android.content.Context;import android.content.DialogInterface;import android.content.Intent;import android.net.Uri;import android.provider.ContactsContract;public class MoreDialog extends Builder{private Context mContext;public static final int PICK_CONTACT_SUBACTIVITY = 2 ;private String[] strarr ;public MoreDialog(Context arg0){super(arg0);mContext = arg0;strarr = new String[]                            { mContext.getString(R.string.from_contact), mContext.getString(R.string.back) };this.setTitle(arg0.getString(R.string.more));this.setItems(strarr, listener);}private DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener(){@Overridepublic void onClick(DialogInterface dialog, int which){switch (which){case 0:Uri uri = ContactsContract.Contacts.CONTENT_URI ;Intent intent = new Intent(Intent.ACTION_PICK,uri) ;Activity activity = (Activity)mContext ;activity.startActivityForResult(intent, PICK_CONTACT_SUBACTIVITY) ;break;default:break;}}};}

?

?

?

热点排行