项目:CSipSimple
文件:ContactsUtils3.java
@Override
public void bindContactPhoneView(View view,Context context,Cursor cursor) {
// Get values
String value = cursor.getString(cursor.getColumnIndex(Phones.NUMBER));
String displayName = cursor.getString(cursor.getColumnIndex(Phones.disPLAY_NAME));
Long peopleId = cursor.getLong(cursor.getColumnIndex(Phones.PERSON_ID));
Uri uri = ContentUris.withAppendedId(People.CONTENT_URI,peopleId);
Bitmap bitmap = getContactPhoto(context,uri,false,R.drawable.ic_contact_picture_holo_dark);
// Get views
TextView tv = (TextView) view.findViewById(R.id.name);
TextView sub = (TextView) view.findViewById(R.id.number);
TextView label = (TextView) view.findViewById(R.id.label);
ImageView imageView = (ImageView) view.findViewById(R.id.contact_photo);
// Bind
label.setVisibility(View.GONE);
view.setTag(value);
tv.setText(displayName);
sub.setText(value);
imageView.setimageBitmap(bitmap);
}
项目:DumbphoneAssistant
文件:PhoneUtilDonut.java
public void create(Contact newPhoneContact) throws Exception {
// first,we have to create the contact
ContentValues newPhoneValues = new ContentValues();
newPhoneValues.put(Contacts.People.NAME,newPhoneContact.getName());
Uri newPhoneRow = resolver.insert(Contacts.People.CONTENT_URI,newPhoneValues);
// then we have to add a number
newPhoneValues.clear();
newPhoneValues.put(Contacts.People.Phones.TYPE,Contacts.People.Phones.TYPE_MOBILE);
newPhoneValues.put(Contacts.Phones.NUMBER,newPhoneContact.getNumber());
// insert the new phone number in the database using the returned uri from creating the contact
newPhoneRow = resolver.insert(Uri.withAppendedpath(newPhoneRow,Contacts.People.Phones.CONTENT_DIRECTORY),newPhoneValues);
// if contacts uri returned,there was an error with adding the number
if (newPhoneRow.getPath().contains("people")) {
throw new Exception(String.valueOf(R.string.error_phone_number_not_stored));
}
// if phone uri returned,everything went OK
if (!newPhoneRow.getPath().contains("phones")) {
// some unkNown error has happened
throw new Exception(String.valueOf(R.string.error_phone_number_error));
}
}
项目:DumbphoneAssistant
文件:PhoneUtilDonut.java
public Uri retrieveContactUri(Contact contact) {
String id = contact.getId();
String[] projection = new String[] { Contacts.Phones.PERSON_ID };
String path = null;
Cursor result;
if (null != id) {
Uri uri = ContentUris.withAppendedId(Contacts.Phones.CONTENT_URI,Long.valueOf(id));
result = resolver.query(uri,projection,null,null);
} else {
String selection = "name='?' AND number='?'";
String[] selectionArgs = new String[] { contact.getName(),contact.getNumber() };
result = resolver.query(Contacts.Phones.CONTENT_URI,selection,selectionArgs,null);
}
if (null != result) {
result.movetoNext();
path = result.getString(0);
result.close();
}
if (null == path) {
return null;
}
return Uri.withAppendedpath(Contacts.People.CONTENT_URI,path);
}
private void assignringtoneToContact() {
Cursor c = mAdapter.getCursor();
int dataIndex = c.getColumnIndexOrThrow(People._ID);
String contactId = c.getString(dataIndex);
dataIndex = c.getColumnIndexOrThrow(People.disPLAY_NAME);
String displayName = c.getString(dataIndex);
Uri uri = Uri.withAppendedpath(getContactContentUri(),contactId);
ContentValues values = new ContentValues();
values.put(People.CUSTOM_ringtone,mringtoneUri.toString());
getContentResolver().update(uri,values,null);
String message =
getResources().getText(R.string.success_contact_ringtone) +
" " +
displayName;
Log.i("Contact Uri",uri.toString());
Log.i("ringtone Uri",mringtoneUri.toString());
Toast.makeText(this,message,Toast.LENGTH_SHORT)
.show();
finish();
return;
}
项目:informant-droid
文件:LoaderRetainedSupport.java
public Loader<Cursor> onCreateLoader(int id,Bundle args) {
// This is called when a new Loader needs to be created. This
// sample only has one Loader,so we don't care about the ID.
// First,pick the base URI to use depending on whether we are
// currently filtering.
Uri baseUri;
if (mCurFilter != null) {
baseUri = Uri.withAppendedpath(People.CONTENT_FILTER_URI,Uri.encode(mCurFilter));
} else {
baseUri = People.CONTENT_URI;
}
// Now create and return a CursorLoader that will take care of
// creating a Cursor for the data being displayed.
String select = "((" + People.disPLAY_NAME + " NOTNULL) AND ("
+ People.disPLAY_NAME + " != '' ))";
return new CursorLoader(getActivity(),baseUri,CONTACTS_SUMMARY_PROJECTION,select,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
项目:informant-droid
文件:LoaderCursorSupport.java
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),android.R.layout.simple_list_item_1,new String[] { People.disPLAY_NAME },new int[] { android.R.id.text1},0);
setlistadapter(mAdapter);
// Start out with a progress indicator.
setListShown(false);
// Prepare the loader. Either re-connect with an existing one,// or start a new one.
getLoaderManager().initLoader(0,this);
}
项目:informant-droid
文件:LoaderCursorSupport.java
public Loader<Cursor> onCreateLoader(int id,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
项目:appdeck-android
文件:LoaderCursorSupport.java
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),this);
}
项目:appdeck-android
文件:LoaderCursorSupport.java
public Loader<Cursor> onCreateLoader(int id,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
项目:tournama
文件:LoaderCursorSupport.java
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),this);
}
项目:tournama
文件:LoaderCursorSupport.java
public Loader<Cursor> onCreateLoader(int id,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
项目:V.FlyoutTest
文件:LoaderRetainedSupport.java
public Loader<Cursor> onCreateLoader(int id,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
项目:V.FlyoutTest
文件:LoaderCursorSupport.java
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),this);
}
项目:V.FlyoutTest
文件:LoaderCursorSupport.java
public Loader<Cursor> onCreateLoader(int id,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
项目:flingtap-done
文件:ContactsListActivity.java
private void returnPickerResult(String name,Uri uri) {
final Intent intent = new Intent();
if (mCreateShortcut) {
Intent shortcutIntent = new Intent(Intent.ACTION_VIEW,uri);
shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,name);
final Bitmap icon = People.loadContactPhoto(this,null);
if (icon != null) {
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON,icon);
} else {
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,Intent.ShortcutIconResource.fromContext(this,// R.drawable.ic_launcher_shortcut_contact));
R.drawable.picture_holder));
}
setResult(RESULT_OK,intent);
} else {
setResult(RESULT_OK,intent.setData(uri));
}
finish();
}
项目:Rogo
文件:LoaderCursorSupport.java
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),this);
}
项目:Rogo
文件:LoaderCursorSupport.java
public Loader<Cursor> onCreateLoader(int id,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
项目:phonty
文件:Caller.java
boolean isExcludedType(Vector<Integer> vExTypesCode,String sNumber,Context oContext)
{
Uri contactRef = Uri.withAppendedpath(Contacts.Phones.CONTENT_FILTER_URL,sNumber);
final String[] PHOnes_PROJECTION = new String[]
{
People.Phones.NUMBER,// 0
People.Phones.TYPE,// 1
};
Cursor phonesCursor = oContext.getContentResolver().query(contactRef,PHOnes_PROJECTION,null);
if (phonesCursor != null)
{
while (phonesCursor.movetoNext())
{
final int type = phonesCursor.getInt(1);
if(vExTypesCode.contains(Integer.valueOf(type)))
return true;
}
phonesCursor.close();
}
return false;
}
项目:learning_gradle_android
文件:LoaderCursorSupport.java
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),this);
}
项目:learning_gradle_android
文件:LoaderCursorSupport.java
public Loader<Cursor> onCreateLoader(int id,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
项目:ActionBarSherlock
文件:LoaderCursorSupport.java
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),this);
}
项目:ActionBarSherlock
文件:LoaderCursorSupport.java
public Loader<Cursor> onCreateLoader(int id,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
项目:ActionBarShareLock
文件:LoaderCursorSupport.java
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),this);
}
项目:ActionBarShareLock
文件:LoaderCursorSupport.java
public Loader<Cursor> onCreateLoader(int id,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
项目:LOLCode
文件:LoaderCursorSupport.java
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),this);
}
项目:LOLCode
文件:LoaderCursorSupport.java
public Loader<Cursor> onCreateLoader(int id,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
项目:kidsm_for_android
文件:LoaderCursorSupport.java
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),this);
}
项目:kidsm_for_android
文件:LoaderCursorSupport.java
public Loader<Cursor> onCreateLoader(int id,People.disPLAY_NAME + " COLLATE LOCALIZED ASC");
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。