我想在列表中显示所有本机联系人,并让用户将列表中的联系人(多个联系人)添加到我的应用程序数据库.如何使用这个可以让任何人给我构思或分享一些代码..在此先感谢..
这是我的代码
Log.i("sdfgsdf", time.toGMTString());
String SENT = "SMS_SENT";
Intent y= new Intent(SENT);
y.putExtra("number", phoneNumber);
y.putExtra("time", time.toString());
String DELIVERED = "SMS_DELIVERED";
int FLAG_UPDATE_CURRENT =(0x08000000) ;
PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,
y, FLAG_UPDATE_CURRENT);
PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0,
new Intent(DELIVERED), FLAG_UPDATE_CURRENT);
//---when the SMS has been sent---
r= new BroadcastReceiver(){
@Override
public void onReceive(Context arg0, Intent arg1) {
switch (getResultCode())
{
case Activity.RESULT_OK:
Toast.makeText(getBaseContext(), "SMS sent"+arg1.getStringExtra("number"),
Toast.LENGTH_SHORT).show();
Constant.DB = Compose.this.openOrCreateDatabase("Indigo",MODE_PRIVATE, null);
Constant.DB.execSQL("UPDATE Message SET IsMsgSent='true' where DateAndTime='" + arg1.getStringExtra("time") + "' and ContactNumber='"+arg1.getStringExtra("number")+"'"); …Run Code Online (Sandbox Code Playgroud) 这是我使用的代码
private String getContactNameFromNumber(String number) {
// define the columns I want the query to return
String[] projection = new String[] {
Contacts.Phones.DISPLAY_NAME,
Contacts.Phones.NUMBER };
// encode the phone number and build the filter URI
Uri contactUri = Uri.withAppendedPath(Contacts.Phones.CONTENT_FILTER_URL, Uri.encode(number));
// query time
Cursor c = getContentResolver().query(contactUri, projection, null,
null, null);
// if the query returns 1 or more results
// return the first result
if (c.moveToFirst()) {
String name = c.getString(c
.getColumnIndex(Contacts.Phones.DISPLAY_NAME));
return name;
}
// return the original …Run Code Online (Sandbox Code Playgroud) 什么是Lua Scripting?我在哪里可以学到它?我想用Lua开发Android游戏,我该如何开始并且可以在Android中使用Lua ..?