List of usage examples for android.provider BaseColumns _ID
String _ID
To view the source code for android.provider BaseColumns _ID.
Click Source Link
From source file:com.csipsimple.ui.favorites.FavLoader.java
/** * Creates a cursor that contains contacts group corresponding to an sip * account./* w w w . j a v a 2 s .c o m*/ */ private Cursor createContentCursorFor(SipProfile account) { Cursor c = null; if (!TextUtils.isEmpty(account.android_group)) { c = ContactsWrapper.getInstance().getContactsByGroup(getContext(), account.android_group); } if (c != null) { return c; } MatrixCursor mc = new MatrixCursor(new String[] { BaseColumns._ID, ContactsWrapper.FIELD_TYPE }); mc.addRow(new Object[] { account.id, ContactsWrapper.TYPE_CONFIGURE }); return mc; }
From source file:org.catnut.fragment.UserTimelineFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { String selection = mSelection; boolean search = args.getBoolean(SEARCH_TWEET); if (search) { if (!TextUtils.isEmpty(mCurFilter)) { selection = new StringBuilder(mSelection).append(" and ").append(Status.columnText).append(" like ") .append(CatnutUtils.like(mCurFilter)).toString(); } else {//from ww w.j a va 2s .c o m search = false; } } int limit = args.getInt(TAG, getFetchSize()); return CatnutUtils.getCursorLoader(getActivity(), CatnutProvider.parse(Status.MULTIPLE), PROJECTION, selection, null, Status.TABLE, null, BaseColumns._ID + " desc", search ? null : String.valueOf(limit)); }
From source file:com.bt.download.android.gui.Librarian.java
public FileDescriptor getFileDescriptor(byte fileType, int fileId, boolean sharedOnly) { List<FileDescriptor> fds = getFiles(0, 1, TableFetchers.getFetcher(fileType), BaseColumns._ID + "=?", new String[] { String.valueOf(fileId) }, sharedOnly); if (fds.size() > 0) { return fds.get(0); } else {/*w ww . j a va 2 s . c o m*/ return null; } }
From source file:com.roamprocess1.roaming4world.ui.favorites.FavLoader.java
/** * Creates a cursor that contains contacts group corresponding to an sip * account.//from www . j av a 2s.co m */ private Cursor createContentCursorFor(SipProfile account) { Cursor c = null; if (!TextUtils.isEmpty(account.android_group)) { c = ContactsWrapper.getInstance().getContactsByGroup(getContext(), account.android_group); } if (c != null) { return c; } MatrixCursor mc = new MatrixCursor(new String[] { BaseColumns._ID, ContactsWrapper.FIELD_TYPE }); mc.addRow(new Object[] { account.id, ContactsWrapper.TYPE_CONFIGURE }); return mc; }
From source file:org.catnut.metadata.User.java
@Override public ContentValues convert(JSONObject json) { ContentValues user = new ContentValues(); user.put(BaseColumns._ID, json.optLong(Constants.ID)); user.put(screen_name, json.optString(screen_name)); user.put(name, json.optString(name)); user.put(province, json.optInt(province)); user.put(city, json.optInt(city));/*from w ww . j a v a 2 s . c om*/ user.put(location, json.optString(location)); user.put(description, json.optString(description)); user.put(url, json.optString(url)); user.put(profile_image_url, json.optString(profile_image_url)); user.put(cover_image, json.optString(cover_image)); user.put(cover_image_phone, json.optString(cover_image_phone)); user.put(profile_url, json.optString(profile_url)); user.put(domain, json.optString(domain)); user.put(weihao, json.optString(weihao)); user.put(gender, json.optString(gender)); user.put(followers_count, json.optInt(followers_count)); user.put(friends_count, json.optInt(friends_count)); user.put(statuses_count, json.optInt(statuses_count)); user.put(favourites_count, json.optInt(favourites_count)); user.put(created_at, json.optString(created_at)); user.put(following, json.optBoolean(following)); user.put(allow_all_act_msg, json.optBoolean(allow_all_act_msg)); user.put(geo_enabled, json.optBoolean(geo_enabled)); user.put(verified, json.optBoolean(verified)); user.put(verified_type, json.optInt(verified_type)); user.put(remark, json.optString(remark)); // user.put(ptype, json.optInt(ptype)); user.put(allow_all_comment, json.optBoolean(allow_all_comment)); user.put(avatar_large, json.optString(avatar_large)); user.put(avatar_hd, json.optString(avatar_hd)); user.put(verified_reason, json.optString(verified_reason)); user.put(follow_me, json.optBoolean(follow_me)); user.put(online_status, json.optInt(online_status)); user.put(bi_followers_count, json.optInt(bi_followers_count)); user.put(lang, json.optString(lang)); // user.put(star, json.optString(star)); // user.put(mbtype, json.optInt(mbtype)); // user.put(mbrank, json.optInt(mbrank)); // user.put(block_word, json.optInt(block_word)); // ?id if (json.has(SINGLE)) { user.put(status_id, json.optJSONObject(Status.SINGLE).optLong(Constants.ID)); } return user; }
From source file:com.roamprocess1.roaming4world.ui.favorites.FavAdapter.java
@Override public void bindView(View view, final Context context, Cursor cursor) { ContentValues cv = new ContentValues(); DatabaseUtils.cursorRowToContentValues(cursor, cv); int type = ContactsWrapper.TYPE_CONTACT; if (cv.containsKey(ContactsWrapper.FIELD_TYPE)) { type = cv.getAsInteger(ContactsWrapper.FIELD_TYPE); }// ww w . ja va2 s . co m showViewForType(view, type); if (type == ContactsWrapper.TYPE_GROUP) { // Get views TextView tv = (TextView) view.findViewById(R.id.header_text); ImageView icon = (ImageView) view.findViewById(R.id.header_icon); // PresenceStatusSpinner presSpinner = (PresenceStatusSpinner) view.findViewById(R.id.header_presence_spinner); // Get datas SipProfile acc = new SipProfile(cursor); final Long profileId = cv.getAsLong(BaseColumns._ID); final String groupName = acc.android_group; final String displayName = acc.display_name; final String wizard = acc.wizard; final boolean publishedEnabled = (acc.publish_enabled == 1); final String domain = acc.getDefaultDomain(); // Bind datas to view //tv.setText(displayName); //Commented by Esstel Softwares tv.setText("Starred Android Contacts"); icon.setImageResource(WizardUtils.getWizardIconRes(wizard)); // presSpinner.setProfileId(profileId); // Extra menu view if not already set ViewGroup menuViewWrapper = (ViewGroup) view.findViewById(R.id.header_cfg_spinner); MenuCallback newMcb = new MenuCallback(context, profileId, groupName, domain, publishedEnabled); MenuBuilder menuBuilder; if (menuViewWrapper.getTag() == null) { final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); ActionMenuPresenter mActionMenuPresenter = new ActionMenuPresenter(mContext); mActionMenuPresenter.setReserveOverflow(true); menuBuilder = new MenuBuilder(context); menuBuilder.setCallback(newMcb); MenuInflater inflater = new MenuInflater(context); inflater.inflate(R.menu.fav_menu_new, menuBuilder); menuBuilder.addMenuPresenter(mActionMenuPresenter); ActionMenuView menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(menuViewWrapper); UtilityWrapper.getInstance().setBackgroundDrawable(menuView, null); menuViewWrapper.addView(menuView, layoutParams); menuViewWrapper.setTag(menuBuilder); } else { menuBuilder = (MenuBuilder) menuViewWrapper.getTag(); menuBuilder.setCallback(newMcb); } // menuBuilder.findItem(R.id.share_presence).setTitle(publishedEnabled ? R.string.deactivate_presence_sharing : R.string.activate_presence_sharing); // menuBuilder.findItem(R.id.set_sip_data).setVisible(!TextUtils.isEmpty(groupName)); } else if (type == ContactsWrapper.TYPE_CONTACT) { ContactInfo ci = ContactsWrapper.getInstance().getContactInfo(context, cursor); ci.userData = cursor.getPosition(); // Get views TextView tv = (TextView) view.findViewById(R.id.contact_name); QuickContactBadge badge = (QuickContactBadge) view.findViewById(R.id.quick_contact_photo); TextView statusText = (TextView) view.findViewById(R.id.status_text); ImageView statusImage = (ImageView) view.findViewById(R.id.status_icon); // Bind if (ci.contactId != null) { tv.setText(ci.displayName); badge.assignContactUri(ci.callerInfo.contactContentUri); ContactsAsyncHelper.updateImageViewWithContactPhotoAsync(context, badge.getImageView(), ci.callerInfo, R.drawable.ic_contact_picture_holo_dark); statusText.setVisibility(ci.hasPresence ? View.VISIBLE : View.GONE); statusText.setText(ci.status); statusImage.setVisibility(ci.hasPresence ? View.VISIBLE : View.GONE); statusImage.setImageResource(ContactsWrapper.getInstance().getPresenceIconResourceId(ci.presence)); } View v; v = view.findViewById(R.id.contact_view); v.setTag(ci); v.setOnClickListener(mPrimaryActionListener); v = view.findViewById(R.id.secondary_action_icon); v.setTag(ci); v.setOnClickListener(mSecondaryActionListener); } else if (type == ContactsWrapper.TYPE_CONFIGURE) { // We only bind if it's the correct type // View v = view.findViewById(R.id.configure_view); //v.setOnClickListener(this); //ConfigureObj cfg = new ConfigureObj(); // cfg.profileId = cv.getAsLong(BaseColumns._ID); // v.setTag(cfg); } }
From source file:com.grokkingandroid.sampleapp.samples.data.contentprovider.lentitems.LentItemFormFragment.java
@Override public void onPause() { super.onPause(); if (getActivity() != null && !mWasActivityForResultStarted) { Intent intent = new Intent(getActivity(), LentItemService.class); intent.putExtra(Items.NAME, mTxtName.getText().toString()); intent.putExtra(Items.BORROWER, mTxtBorrower.getText().toString()); if (mPhotoUri != null) { intent.putExtra(Photos._DATA, mPhotoUri.toString()); }//ww w . j a va2 s .c o m if (mItemId == -1) { intent.setAction(LentItemService.ACTION_CREATE_ITEM); } else { intent.putExtra(BaseColumns._ID, mItemId); intent.setAction(LentItemService.ACTION_UPDATE_ITEM); } getActivity().startService(intent); } }
From source file:org.c99.SyncProviderDemo.ContactsSyncAdapterService.java
private static void updateContactStatus(ArrayList<ContentProviderOperation> operationList, long rawContactId, String status) {// ww w. j av a 2 s.c om Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId); Uri entityUri = Uri.withAppendedPath(rawContactUri, Entity.CONTENT_DIRECTORY); Cursor c = mContentResolver.query(entityUri, new String[] { RawContacts.SOURCE_ID, Entity.DATA_ID, Entity.MIMETYPE, Entity.DATA1 }, null, null, null); try { while (c.moveToNext()) { if (!c.isNull(1)) { String mimeType = c.getString(2); if (mimeType.equals("vnd.android.cursor.item/vnd.org.c99.SyncProviderDemo.profile")) { ContentProviderOperation.Builder builder = ContentProviderOperation .newInsert(ContactsContract.StatusUpdates.CONTENT_URI); builder.withValue(ContactsContract.StatusUpdates.DATA_ID, c.getLong(1)); builder.withValue(ContactsContract.StatusUpdates.STATUS, status); builder.withValue(ContactsContract.StatusUpdates.STATUS_RES_PACKAGE, "org.c99.SyncProviderDemo"); builder.withValue(ContactsContract.StatusUpdates.STATUS_LABEL, R.string.app_name); builder.withValue(ContactsContract.StatusUpdates.STATUS_ICON, R.drawable.logo); builder.withValue(ContactsContract.StatusUpdates.STATUS_TIMESTAMP, System.currentTimeMillis()); operationList.add(builder.build()); //Only change the text of our custom entry to the status message pre-Honeycomb, as the newer contacts app shows //statuses elsewhere if (Integer.decode(Build.VERSION.SDK) < 11) { builder = ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI); builder.withSelection(BaseColumns._ID + " = '" + c.getLong(1) + "'", null); builder.withValue(ContactsContract.Data.DATA3, status); operationList.add(builder.build()); } } } } } finally { c.close(); } }
From source file:com.wheelly.activity.FilterDialog.java
private void updateLocationFromFilter(ContentValues filter, final Cursor locationCursor) { long locationId = filter.containsKey(F.LOCATION) ? filter.getAsLong(F.LOCATION) : 0; if (locationId > 0 && Utils.moveCursor(locationCursor, BaseColumns._ID, locationId) != -1) { final ContentValues location = LocationBroker.deserialize(locationCursor); c.location.setText(location != null ? location.getAsString("name") : filterValueNotFound); } else {/*from w w w .j a v a 2 s. c o m*/ c.location.setText(R.string.no_filter); } }
From source file:ru.valle.safetrade.SellActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sell);/*from w w w . j a v a2s .c o m*/ passwordView = (TextView) findViewById(R.id.password); intermediateCodeView = (TextView) findViewById(R.id.intermediate_code); balanceView = (TextView) findViewById(R.id.balance); addressLabelView = findViewById(R.id.address_label); addressView = (TextView) findViewById(R.id.address); confirmationCodeView = (EditText) findViewById(R.id.confirmation_code); privateKeyView = (EditText) findViewById(R.id.private_key); finalAddressView = (TextView) findViewById(R.id.final_address); takeButton = (TextView) findViewById(R.id.take_button); findViewById(R.id.send_intermediate_code_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { sendIntermediateCode(); } }); findViewById(R.id.scan_confirmation_code_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(SellActivity.this, ScanActivity.class).putExtra(ScanActivity.EXTRA_TITLE, getString(R.string.scan_confirmation_code_title)); startActivityForResult(intent, REQUEST_SCAN_CONFIRMATION_CODE); } }); findViewById(R.id.scan_encrypted_private_key_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(SellActivity.this, ScanActivity.class).putExtra(ScanActivity.EXTRA_TITLE, getString(R.string.scan_encrypted_private_key_title)); startActivityForResult(intent, REQUEST_SCAN_PRIVATE_KEY); } }); findViewById(R.id.scan_final_address_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(SellActivity.this, ScanActivity.class).putExtra(ScanActivity.EXTRA_TITLE, getString(R.string.scan_final_address_title)); startActivityForResult(intent, REQUEST_SCAN_FINAL_ADDRESS); } }); takeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { takeFunds(); } }); rowId = getIntent().getLongExtra(BaseColumns._ID, -1); }