LayoutInflater inflater = getLayoutInflater();
final View layout = inflaterinflate(Rlayoutconfig,
(ViewGroup) findViewById(RidtableView));
new AlertDialogBuilder(vgetContext())setTitle("设置选项")setView(layout)
setPositiveButton("设置", new DialogInterfaceOnClickListener() {
public void onClick(DialogInterface dialog, int which){
EditText add=(EditText)layoutfindViewById(Ridaddress_c);
EditText po=(EditText)layoutfindViewById(Ridport_c);
if(add!=null&&po!=null)
{
if(addgetText()toString()!=""&&pogetText()toString()!="")
insertConfigData(addgetText()toString(),pogetText()toString());
}
//String address=addgetText()toString();
//String port=pogetText()toString();
//将获取的值组装成一条记录插入到数据库中
/
emptyTable();
insertConfigData("12220512939","8080");
/
return;
}})
setNegativeButton("取消", null)show();
楼上说得不错,我补充一点,你先开启一个线程,然后在线程里面写一个死循环,让java代码不断的去获取系统时间,注意一定要把死循环放在你单独开启的那个线程里面,不然会出错哦 可以用while(true){代码} 这种形式来写,循环代码里面主要包含两个内容,一个是获取系统当前时间,然后让线程睡眠一秒钟,就是调用Thread里面的sleep方法,这样就可以了
以 bookshelf 为例 ,为其设置适配器 adapter,设置点击事键,在class ShlefAdapter 中的getItem方法中得到 item值
bookShelf = (GridView) findViewById (RidbookShelf);
ShlefAdapter adapter=new ShlefAdapter();
bookShelfsetAdapter(adapter);
/girdview 中的 item 单击响应/
bookShelfsetOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<> arg0, final View arg1, final int arg2, long arg3) {
// TODO Auto-generated method stub
/省略/
}
});
/自定义基于BaseAdapter 的 ShlefAdapter 类 , 显示图书/
class ShlefAdapter extends BaseAdapter{
@Override
public int getCount() {
// TODO Auto-generated method stub
return datalength+1;
}
@Override
public Object getItem(int arg0) { //得到所点击的Item的值。
// TODO Auto-generated method stub
return arg0;
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
@Override
public View getView(int position, View contentView, ViewGroup arg2) {
// TODO Auto-generated method stub
//动态载入item
contentView=LayoutInflaterfrom(getApplicationContext())inflate(Rlayoutitem1, null);
TextView view=(TextView) contentViewfindViewById(RidimageView1);
/省略/
return contentView;
}
}
android如何获取联络人所有资讯 获取联络人必须新增许可权
<uses-permission android:name="androidpermissionREAD_CONTACTS" />
如何获取手机联络人资讯
根据ContactsContractContactsCONTENT_URI查询ContentResolver里面的资料,逐个取值即可。
如何获取sim卡的联络人资讯
根据目前查询的资讯来看,sim联络人的uri有两种:
content:i/adn
content:sim/adn
挨个去取即可。
如何获取联络人所有栏位
package ihopemozyhomeutil;import javautilArrayList;import javautilList;import jsonJSONException;import jsonJSONObject;import androidcontentContext;import androiddatabaseCursor;import androidproviderContactsContractCommonDataKindsEmail;import androidproviderContactsContractCommonDataKindsEvent;import androidproviderContactsContractCommonDataKindsIm;import androidproviderContactsContractCommonDataKindsNickname;import androidproviderContactsContractCommonDataKindsNote;import androidproviderContactsContractCommonDataKindsOrganization;import androidproviderContactsContractCommonDataKindsPhone;import androidproviderContactsContractCommonDataKindsStructuredName;import androidproviderContactsContractCommonDataKindsStructuredPostal;import androidproviderContactsContractCommonDataKindsWebsite;import androidproviderContactsContractData;import androidutilLog;import ihopemozyhomedomainContacts;public class GetContactsInfo {private List<Contacts> list;private Context context;private JSONObject contactData;private JSONObject jsonObject;public GetContactsInfo(Context context) { thiscontext = context;}public String getContactInfo() throws JSONException { 获得通讯录资讯 ,URI是ContactsContractContactsCONTENT_URI list = new ArrayList<Contacts>(); contactData = new JSONObject(); String mimetype = ""; int oldrid = -1; int contactId = -1; Cursor cursor = contextgetContentResolver()query(DataCONTENT_URI,null, null, null, DataRAW_CONTACT_ID); int numm=0; while (cursormoveToNext()) { contactId = cursorgetInt(cursorgetColumnIndex(DataRAW_CONTACT_ID)); if (oldrid != contactId) { jsonObject = new JSONObject(); contactDataput("contact" + numm, jsonObject); numm++; oldrid = contactId; } 取得mimetype型别 mimetype = cursorgetString(cursorgetColumnIndex(DataMIMETYPE)); 获得通讯录中每个联络人的ID 获得通讯录中联络人的名字 if (StructuredNameCONTENT_ITEM_TYPEequals(mimetype)) { String display_name = cursorgetString(cursorgetColumnIndex(StructuredNameDISPLAY_NAME)); String prefix = cursorgetString(cursorgetColumnIndex(StructuredNamePREFIX)); jsonObjectput("prefix", prefix); String firstName = cursorgetString(cursorgetColumnIndex(StructuredNameFAMILY_NAME)); jsonObjectput("firstName", firstName); String middleName = cursorgetString(cursorgetColumnIndex(StructuredNameMIDDLE_NAME)); jsonObjectput("middleName", middleName); String lastname = cursorgetString(cursorgetColumnIndex(StructuredNameGIVEN_NAME)); jsonObjectput("lastname", lastname); String suffix = cursorgetString(cursorgetColumnIndex(StructuredNameSUFFIX)); jsonObjectput("suffix", suffix); String phoicFirstName = cursorgetString(cursorgetColumnIndex(StructuredNamePHONETIC_FAMILY_NAME)); jsonObjectput("phoicFirstName", phoicFirstName); String phoicMiddleName = cursorgetString(cursorgetColumnIndex(StructuredNamePHONETIC_MIDDLE_NAME)); jsonObjectput("phoicMiddleName", phoicMiddleName); String phoicLastName = cursorgetString(cursorgetColumnIndex(StructuredNamePHONETIC_GIVEN_NAME)); jsonObjectput("phoicLastName", phoicLastName); } 获取电话资讯 if (PhoneCONTENT_ITEM_TYPEequals(mimetype)) { 取出电话型别 int phoneType = cursorgetInt(cursorgetColumnIndex(PhoneTYPE)); 手机 if (phoneType == PhoneTYPE_MOBILE) { String mobile = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("mobile", mobile); } 住宅电话 if (phoneType == PhoneTYPE_HOME) { String homeNum = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("homeNum", homeNum); } 单位电话 if (phoneType == PhoneTYPE_WORK) { String jobNum = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("jobNum", jobNum); } 单位传真 if (phoneType == PhoneTYPE_FAX_WORK) { String workFax = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("workFax", workFax); } 住宅传真 if (phoneType == PhoneTYPE_FAX_HOME) { String homeFax = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("homeFax", homeFax); } 寻呼机 if (phoneType == PhoneTYPE_PAGER) { String pager = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("pager", pager); } 回拨号码 if (phoneType == PhoneTYPE_CALLBACK) { String quickNum = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("quickNum", quickNum); } 公司总机 if (phoneType == PhoneTYPE_COMPANY_MAIN) { String jobTel = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("jobTel", jobTel); } 车载电话 if (phoneType == PhoneTYPE_CAR) { String carNum = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("carNum", carNum); } ISDN if (phoneType == PhoneTYPE_ISDN) { String isdn = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("isdn", isdn); } 总机 if (phoneType == PhoneTYPE_MAIN) { String tel = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("tel", tel); } 无线装置 if (phoneType == PhoneTYPE_RADIO) { String wirelessDev = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("wirelessDev", wirelessDev); } 电报 if (phoneType == PhoneTYPE_TELEX) { String telegram = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("telegram", telegram); } TTY_TDD if (phoneType == PhoneTYPE_TTY_TDD) { String tty_tdd = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("tty_tdd", tty_tdd); } 单位手机 if (phoneType == PhoneTYPE_WORK_MOBILE) { String jobMobile = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("jobMobile", jobMobile); } 单位寻呼机 if (phoneType == PhoneTYPE_WORK_PAGER) { String jobPager = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("jobPager", jobPager); } 其他通讯地址 if (postalType == StructuredPostalTYPE_OTHER) { String otherStreet = cursorgetString(cursorgetColumnIndex(StructuredPostalSTREET)); jsonObjectput("otherStreet", otherStreet); String otherCity = cursorgetString(cursorgetColumnIndex(StructuredPostalCITY)); jsonObjectput("otherCity", otherCity); String otherBox = cursorgetString(cursorgetColumnIndex(StructuredPostalPOBOX)); jsonObjectput("otherBox", otherBox); String otherArea = cursorgetString(cursorgetColumnIndex(StructuredPostalNEIGHBORHOOD)); jsonObjectput("otherArea", otherArea); String otherState = cursorgetString(cursorgetColumnIndex(StructuredPostalREGION)); jsonObjectput("otherState", otherState); String otherZip = cursorgetString(cursorgetColumnIndex(StructuredPostalPOSTCODE)); jsonObjectput("otherZip", otherZip); String otherCountry = cursorgetString(cursorgetColumnIndex(StructuredPostalCOUNTRY)); jsonObjectput("otherCountry", otherCountry); } } } cursorclose(); Logi("contactData", contactDatatoString()); return contactDatatoString();}}
拍拍贷如何获取联络人
拍拍贷app 可以获取你的通讯录,新浪有借也一样
而且更加好用
它的话是利息按日计,随时还款。
而一般的网贷如借10000,按照目前不低的年化收益率10%来计算的话, 一个月利息是83左右。 计算公式你记一下 10000x10%=1000(这里得出的是一年的收益) 1000/12=83 (除以12个月,才得到你一个月的)
微锁屏获取联络人资讯有风险吗
国内的很多软体都申请了很多不需要的许可权,锁屏软体应该是不需要读取联络人资讯的,可以安装一些软体取消锁屏软体的读取联络人许可权。
android怎么获取联络人头像
必须先编辑成正方形,或你的联络人有自动减取功能,不然头像肯定变形!
手机常显示易信正在尝试获取联络人资讯
这应该是易信在读取你的联络人,以便获取已经用手机号码注册了易信的手机上的联络人,可以考虑解除安装易信(如果不经常用的话)其实很多软体都喜欢读取个人资讯。。
为什么百度HI新增联络人时总是正在获取联络人资讯
应该是网速慢,如果你确定你的网速正常,那有可能是百度系统出错了。
我也遇到过这种情况。
还有一种可能,就是你新增的联络人不存在,或名字输入错误。
什么软体可以汇出联络人所有资讯
360手机卫士、qq都提供了云端备份通讯录的功能。现在备份到云端伺服器上是最安全的,永远不会丢失,换手机前备份一下,新手机上就可以下载到。平日经常备份联络人资讯,安全可靠有保障。
android开发怎样获取通讯录联络人资讯
public class ContactsActivity extends ListActivity {
Context mContext = null;
/获取库Phon表字段/
private static final String[] PHONES_PROJECTION = new String[] {
PhoneDISPLAY_NAME, PhoneNUMBER, PhotoPHOTO_ID,PhoneCONTACT_ID };
/联络人显示名称/
private static final int PHONES_DISPLAY_NAME_INDEX = 0;
/电话号码/
private static final int PHONES_NUMBER_INDEX = 1;
/头像ID/
private static final int PHONES_PHOTO_ID_INDEX = 2;
/联络人的ID/
private static final int PHONES_CONTACT_ID_INDEX = 3;
/联络人名称/
private ArrayList<String> mContactsName = new ArrayList<String>();
/联络人头像/
private ArrayList<String> mContactsNumber = new ArrayList<String>();
/联络人头像/
private ArrayList<Bitmap> mContactsPhonto = new ArrayList<Bitmap>();
ListView mListView = null;
MyListAdapter myAdapter = null;
@Override
public void onCreate(Bundle savedInstanceState) {
mContext = this;
mListView = thisgetListView();
/得到手机通讯录联络人资讯/
getPhoneContacts();
myAdapter = new MyListAdapter(this);
setListAdapter(myAdapter);
mListViewsetOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<> adapterView, View view,
int position, long id) {
呼叫系统方法拨打电话
Intent dialIntent = new Intent(IntentACTION_CALL, Uri
parse("tel:" + mContactsNumberget(position)));
startActivity(dialIntent);
}
});
superonCreate(savedInstanceState);
}
/得到手机通讯录联络人资讯/
private void getPhoneContacts() {
ContentResolver resolver = mContextgetContentResolver();
获取手机联络人
Cursor phoneCursor = resolverquery(PhoneCONTENT_URI,PHONES_PROJECTION, null, null, null);
if (phoneCursor != null) {
while (phoneCursormoveToNext()) {
得到手机号码
String phoneNumber = phoneCursorgetString(PHONES_NUMBER_INDEX);
当手机号码为空的或者为空栏位 跳过当前回圈
if (TextUtilsisEmpty(phoneNumber))
continue;
得到联络人名称
String contactName = phoneCursorgetString(PHONES_DISPLAY_NAME_INDEX);
得到联络人ID
Long contactid = phoneCursorgetLong(PHONES_CONTACT_ID_INDEX);
得到联络人头像ID
Long photoid = phoneCursorgetLong(PHONES_PHOTO_ID_INDEX);
得到联络人头像Bitamp
Bitmap contactPhoto = null;
photoid 大于0 表示联络人有头像 如果没有给此人设定头像则给他一个预设的
if(photoid > 0 ) {
Uri uri =ContentUriswithAppendedId(ContactsContractContactsCONTENT_URI,contactid);
InputStream input = ContactsContractContactsopenContactPhotoInputStream(resolver, uri);
contactPhoto = BitmapFactorydecodeStream(input);
}else {
contactPhoto = BitmapFactorydecodeResource(getResources(), Rdrawablecontact_photo);
}
mContactsNameadd(contactName);
mContactsNumberadd(phoneNumber);
mContactsPhontoadd(contactPhoto);
}
phoneCursorclose();
}
}
/得到手机SIM卡联络人人资讯/
private void getSIMContacts() {
ContentResolver resolver = mContextgetContentResolver();
获取Sims卡联络人
Uri uri = Uriparse("content:i/adn");
Cursor phoneCursor = resolverquery(uri, PHONES_PROJECTION, null, null,
null);
if (phoneCursor != null) {
while (phoneCursormoveToNext()) {
得到手机号码
String phoneNumber = phoneCursorgetString(PHONES_NUMBER_INDEX);
当手机号码为空的或者为空栏位 跳过当前回圈
if (TextUtilsisEmpty(phoneNumber))
continue;
得到联络人名称
String contactName = phoneCursor
getString(PHONES_DISPLAY_NAME_INDEX);
Sim卡中没有联络人头像
mContactsNameadd(contactName);
mContactsNumberadd(phoneNumber);
}
phoneCursorclose();
}
}
class MyListAdapter extends BaseAdapter {
public MyListAdapter(Context context) {
mContext = context;
}
public int getCount() {
设定绘制数量
return mContactsNamesize();
}
@Override
public boolean areAllItemsEnabled() {
return false;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
ImageView iamge = null;
TextView title = null;
TextView text = null;
if (convertView == null) {
convertView = LayoutInflaterfrom(mContext)inflate(
Rlayoutcolorlist, null);
iamge = (ImageView) convertViewfindViewById(Ridcolor_image);
title = (TextView) convertViewfindViewById(Ridcolor_title);
text = (TextView) convertViewfindViewById(Ridcolor_text);
}
绘制联络人名称
titlesetText(mContactsNameget(position));
绘制联络人号码
textsetText(mContactsNumberget(position));
绘制联络人头像
iamgesetImageBitmap(mContactsPhontoget(position));
return convertView;
}
}
}
以上就是关于android 怎么获取alertdailog自定义布局里的控件全部的内容,包括:android 怎么获取alertdailog自定义布局里的控件、java中获取了当前系统地时间,怎样每秒获取更新一次呢、onitemclicklistene里怎么获取当前item等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)