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:org.catnut.plugin.zhihu.Zhihu.java
@Override public String ddl() { StringBuilder sql = new StringBuilder(); // ?//w w w. j a v a 2 s . co m // _id ??id sql.append("CREATE TABLE ").append(TABLE).append("(").append(BaseColumns._ID).append(" int,") .append(QUESTION_ID).append(" int,").append(TITLE).append(" text,").append(DESCRIPTION) .append(" text,") .append(ANSWER_ID).append(" int primary key,").append(ANSWER).append(" text,") .append(LAST_ALTER_DATE).append(" int,") .append(UID).append(" text,").append(NICK).append(" text,").append(STATUS).append(" text,") .append(AVATAR).append(" text,").append(HAS_READ).append(" int").append(")"); return sql.toString(); }
From source file:com.espian.ticktock.AddEditActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.addedit);/*from w ww .ja va 2s . c o m*/ getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayShowCustomEnabled(true); getActionBar().setCustomView(R.layout.title_edit_text); mTitle = (EditText) getActionBar().getCustomView(); mMaxDate = Calendar.getInstance(); mMaxDate.add(Calendar.YEAR, 2); mDatePicker = (CalendarPickerView) findViewById(R.id.calendarPicker); mDatePicker.init(new Date(), new Date(), mMaxDate.getTime()); //mTitle = (EditText) findViewById(R.id.labelEdit); editId = getIntent().getStringExtra(BaseColumns._ID); if (isEdit = (editId != null)) { // Only want the fade-in loader if it's an edit, else we can load everything instantly mHelper = new LoadHideHelper(findViewById(R.id.loadingitems)); getLoaderManager().initLoader(TickTockProvider.LOADER_SINGLE_ITEM, getIntent().getExtras(), this); } }
From source file:de.hska.iam.presentationapp.queries.Query.java
private String[] getProjectionWithId() { List<String> projection = getProjection(); projection.add(0, BaseColumns._ID); return projection.toArray(new String[projection.size()]); }
From source file:com.dmsl.anyplace.nav.AnyPlaceSeachingHelper.java
public static Cursor prepareSearchViewCursor(List<? extends IPoisClass> places, String query) { String req_columns[] = { BaseColumns._ID, SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_INTENT_DATA }; MatrixCursor mcursor = new MatrixCursor(req_columns); int i = 0;/*from www. j av a 2s. co m*/ if (places != null) { GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(IPoisClass.class, new IPoisClass.MyInterfaceAdapter()); Gson gson = gsonBuilder.create(); // Better Use AndroidUtils.fillTextBox instead of regular expression // Regular expression // ?i ignore case Pattern patternTitle = Pattern.compile(String.format("((?i)%s)", query)); // Matches X words before query and Y words after Pattern patternDescription = Pattern.compile( String.format("(([^\\s]+\\s+){0,%d}[^\\s]*)((?i)%s)([^\\s]*(\\s+[^\\s]+){0,%d})", 2, query, 2)); for (IPoisClass p : places) { String name = "", description = ""; Matcher m; m = patternTitle.matcher(p.name()); // Makes matched query bold using HTML format // $1 returns the regular's expression outer parenthesis value name = m.replaceAll("<b>$1</b>"); m = patternDescription.matcher(p.description()); if (m.find()) { // Makes matched query bold using HTML format description = String.format(" %s<b>%s</b>%s", m.group(1), m.group(3), m.group(4)); } mcursor.addRow(new String[] { Integer.toString(i++), name + description, gson.toJson(p, IPoisClass.class) }); } } return mcursor; }
From source file:com.abcvoipsip.ui.favorites.FavAdapter.java
@Override public void bindView(View view, 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 . jav a 2s .co m*/ if (type == ContactsWrapper.TYPE_GROUP) { showViewForHeader(view, true); 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); tv.setText(cv.getAsString(SipProfile.FIELD_DISPLAY_NAME)); icon.setImageResource(WizardUtils.getWizardIconRes(cv.getAsString(SipProfile.FIELD_WIZARD))); presSpinner.setProfileId(cv.getAsLong(BaseColumns._ID)); } else { showViewForHeader(view, false); ContactsWrapper.getInstance().bindContactView(view, context, cursor); } }
From source file:com.android.email.provider.EmailMessageCursor.java
public EmailMessageCursor(final Context c, final Cursor cursor, final String htmlColumn, final String textColumn) { super(cursor); mHtmlColumnIndex = cursor.getColumnIndex(htmlColumn); mTextColumnIndex = cursor.getColumnIndex(textColumn); final int cursorSize = cursor.getCount(); mHtmlParts = new SparseArray<String>(cursorSize); mTextParts = new SparseArray<String>(cursorSize); final ContentResolver cr = c.getContentResolver(); while (cursor.moveToNext()) { final int position = cursor.getPosition(); final long messageId = cursor.getLong(cursor.getColumnIndex(BaseColumns._ID)); try {// w w w . j a v a 2 s. c o m if (mHtmlColumnIndex != -1) { final Uri htmlUri = Body.getBodyHtmlUriForMessageWithId(messageId); final InputStream in = cr.openInputStream(htmlUri); final String underlyingHtmlString; try { underlyingHtmlString = IOUtils.toString(in); } finally { in.close(); } final String sanitizedHtml = HtmlSanitizer.sanitizeHtml(underlyingHtmlString); mHtmlParts.put(position, sanitizedHtml); } } catch (final IOException e) { LogUtils.v(LogUtils.TAG, e, "Did not find html body for message %d", messageId); } try { if (mTextColumnIndex != -1) { final Uri textUri = Body.getBodyTextUriForMessageWithId(messageId); final InputStream in = cr.openInputStream(textUri); final String underlyingTextString; try { underlyingTextString = IOUtils.toString(in); } finally { in.close(); } mTextParts.put(position, underlyingTextString); } } catch (final IOException e) { LogUtils.v(LogUtils.TAG, e, "Did not find text body for message %d", messageId); } } cursor.moveToPosition(-1); }
From source file:com.cyanogenmod.filemanager.util.MediaHelper.java
/** * Method that returns the album thumbnail path by its identifier. * * @param cr The ContentResolver/*from w w w . ja v a2 s .co m*/ * @param albumId The album identifier to search * @return String The album thumbnail path */ public static String getAlbumThumbnailPath(@NonNull final ContentResolver cr, final long albumId) { final String[] projection = { MediaStore.Audio.Albums.ALBUM_ART }; final String where = BaseColumns._ID + "=?"; Cursor c = cr.query(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, projection, where, new String[] { String.valueOf(albumId) }, null); try { if (c != null && c.moveToFirst()) { return c.getString(0); } } finally { IOUtils.closeQuietly(c); } return null; }
From source file:com.andrew.apolloMod.helpers.AddIdCursorLoader.java
@Override public Cursor loadInBackground() { Cursor mediaCursor = getContext().getContentResolver().query(mUri, mProjection, mSelection, mSelectionArgs, mSortOrder);//from w w w . j a v a2s. c om //Get cursor filled with Audio Id's String[] projection = new String[] { BaseColumns._ID, AlbumColumns.ALBUM }; Uri uri = Audio.Albums.EXTERNAL_CONTENT_URI; String sortOrder = Audio.Albums.DEFAULT_SORT_ORDER; Cursor albumCursor = getContext().getContentResolver().query(uri, projection, null, null, sortOrder); //Matrix cursor to hold final data to be returned to calling context MatrixCursor cursor = new MatrixCursor(new String[] { BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ARTIST, AudioColumns.ALBUM, AudioColumns.ALBUM_ID }); //Map data from Audio Id cursor to the ALbumName Colum ContentQueryMap mQueryMap = new ContentQueryMap(albumCursor, AlbumColumns.ALBUM, false, null); Map<String, ContentValues> data = mQueryMap.getRows(); if (mediaCursor != null) { while (mediaCursor.moveToNext()) { String id = mediaCursor.getString(mediaCursor.getColumnIndexOrThrow(BaseColumns._ID)); String title = mediaCursor.getString(mediaCursor.getColumnIndexOrThrow(MediaColumns.TITLE)); String artist = mediaCursor.getString(mediaCursor.getColumnIndexOrThrow(AudioColumns.ARTIST)); String album = mediaCursor.getString(mediaCursor.getColumnIndexOrThrow(AudioColumns.ALBUM)); ContentValues tData = data.get(album); String albumid = (String) tData.get(BaseColumns._ID); cursor.addRow(new String[] { id, title, artist, album, albumid }); } mediaCursor.close(); } if (cursor != null) { // Ensure the cursor window is filled registerContentObserver(cursor, mObserver); } return cursor; }
From source file:th.in.ffc.widget.SearchableSpinner.java
public SearchableSpinner setDialog(FragmentManager fm, Class<? extends FFCSearchListDialog> cls, Bundle args, String tag) {//from w ww. j a va 2 s.c o m this.tag = tag; this.fm = fm; Fragment prev = fm.findFragmentByTag(tag); if (prev != null) f = (FFCSearchListDialog) prev; else f = (FFCSearchListDialog) Fragment.instantiate(getContext(), cls.getName(), args); Cursor c = getContext().getContentResolver().query(f.getContentUri(), f.getProjection(), null, null, BaseColumns._ID); mAdapter = new HighLightCursorAdapter(getContext(), f.getLayout(), c, f.getFrom(), f.getTo()); f.setItemClickListener(this); this.setAdapter(mAdapter); return this; }
From source file:com.pawnua.android.app.gpstrips.activities.TripGalleryViewPagerActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_trip_gallery_viewpager); // https://developer.android.com/intl/ru/training/system-ui/immersive.html View decorView = getWindow().getDecorView(); // Hide the status bar (Sticky Immersion) decorView.setSystemUiVisibility(/* w w w .ja v a 2s.com*/ View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); trip = Trip.getTripByID(getIntent().getLongExtra(BaseColumns._ID, -1)); int setCurrentItem = getIntent().getIntExtra("CurrentItem", 0); String currentItem = getIntent().getStringExtra(GalleryDataManager.GALLERY_CURRENT_ITEM_PATH); mFragmentManager = getSupportFragmentManager(); mContext = this; mGalleryFolder = GalleryDataManager.createImageGallery(trip); // disable toolbar // final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); // // setSupportActionBar(toolbar); // // ActionBar actionBar = getSupportActionBar(); // actionBar.setDisplayHomeAsUpEnabled(true); // actionBar.setTitle(getTripTitle(trip)); ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); if (viewPager != null) { GalleryViewPagerAdapter galleryViewPagerAdapter = new GalleryViewPagerAdapter(mFragmentManager, GalleryDataManager.getFileImages(mGalleryFolder)); viewPager.setAdapter(galleryViewPagerAdapter); if (setCurrentItem != 0) viewPager.setCurrentItem(setCurrentItem); if (currentItem != "") viewPager.setCurrentItem(galleryViewPagerAdapter.getItemPosition(currentItem)); } }