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.metadata.Comment.java
@Override public String ddl() { Log.d(TABLE, "create table [" + TABLE + "]"); StringBuilder ddl = new StringBuilder("CREATE TABLE "); ddl.append(TABLE).append("(").append(BaseColumns._ID).append(" int primary key,").append(created_at) .append(" text,").append(columnText).append(" text,").append(source).append(" text,").append(uid) .append(" int,").append(status).append(" text,").append(reply_comment).append(" text").append(")"); return ddl.toString(); }
From source file:com.dmsl.anyplace.nav.AnyPlaceSeachingHelper.java
public static Cursor prepareSearchViewCursor(List<? extends IPoisClass> places) { String req_columns[] = { BaseColumns._ID, SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2, SearchManager.SUGGEST_COLUMN_INTENT_DATA }; MatrixCursor mcursor = new MatrixCursor(req_columns); int i = 0;/*w w w. ja v a 2 s . c o m*/ if (places != null) { GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(IPoisClass.class, new IPoisClass.MyInterfaceAdapter()); Gson gson = gsonBuilder.create(); for (IPoisClass p : places) { mcursor.addRow(new String[] { Integer.toString(i++), p.name(), p.description().equals("") ? "no description" : p.description(), gson.toJson(p, IPoisClass.class) }); } } return mcursor; }
From source file:com.rks.musicx.data.loaders.ArtistLoader.java
@Override public List<Artist> loadInBackground() { List<Artist> artistList = new ArrayList<>(); if (PermissionChecker.checkCallingOrSelfPermission(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE) == PermissionChecker.PERMISSION_GRANTED) { Cursor cursor = getContext().getContentResolver().query(MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI, null, null, null, sortorder); if (cursor != null && cursor.moveToFirst()) { int idCol = cursor.getColumnIndex(BaseColumns._ID); int nameCol = cursor.getColumnIndex(MediaStore.Audio.ArtistColumns.ARTIST); int albumsNbCol = cursor.getColumnIndex(MediaStore.Audio.ArtistColumns.NUMBER_OF_ALBUMS); int tracksNbCol = cursor.getColumnIndex(MediaStore.Audio.ArtistColumns.NUMBER_OF_TRACKS); do {//from w ww . j a v a 2 s . co m long id = cursor.getLong(idCol); String artistName = cursor.getString(nameCol); int albumCount = cursor.getInt(albumsNbCol); int trackCount = cursor.getInt(tracksNbCol); artistList.add(new Artist(id, artistName, albumCount, trackCount)); } while (cursor.moveToNext()); cursor.close(); } if (cursor == null) { return Collections.emptyList(); } return artistList; } else { return null; } }
From source file:com.rks.musicx.data.loaders.ArtistAlbumLoader.java
@Override public List<Artist> loadInBackground() { List<Artist> artistList = new ArrayList<>(); if (PermissionChecker.checkCallingOrSelfPermission(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE) == PermissionChecker.PERMISSION_GRANTED) { Cursor cursor = getContext().getContentResolver().query( MediaStore.Audio.Artists.Albums.getContentUri("external", artistID), null, null, null, sortorder);/* w ww . ja v a 2 s . c o m*/ if (cursor != null && cursor.moveToFirst()) { int idCol = cursor.getColumnIndex(BaseColumns._ID); int nameCol = cursor.getColumnIndex(MediaStore.Audio.Artists.Albums.ARTIST); int albumsNbCol = cursor.getColumnIndex(MediaStore.Audio.Artists.Albums.NUMBER_OF_SONGS_FOR_ARTIST); int tracksNbCol = cursor.getColumnIndex(MediaStore.Audio.Artists.Albums.NUMBER_OF_SONGS); do { long id = cursor.getLong(idCol); String artistName = cursor.getString(nameCol); int albumCount = cursor.getInt(albumsNbCol); int trackCount = cursor.getInt(tracksNbCol); artistList.add(new Artist(id, artistName, albumCount, trackCount)); } while (cursor.moveToNext()); cursor.close(); } if (cursor == null) { return Collections.emptyList(); } return artistList; } else { return null; } }
From source file:com.pawnua.android.app.gpstrips.activities.TripGalleryActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_trip_gallery); trip = Trip.getTripByID(getIntent().getLongExtra(BaseColumns._ID, -1)); mFragmentManager = getSupportFragmentManager(); mGalleryFolder = GalleryDataManager.createImageGallery(trip); initRecyclerView();//www . java 2s . co m final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(getTripTitle(trip)); }
From source file:org.catnut.metadata.Comment.java
@Override public ContentValues convert(JSONObject data) { ContentValues values = new ContentValues(); values.put(BaseColumns._ID, data.optLong(Constants.ID)); values.put(created_at, data.optString(created_at)); values.put(columnText, data.optString(text)); values.put(source, data.optString(source)); JSONObject user = data.optJSONObject(User.SINGLE); if (user != null) { values.put(uid, user.optLong(Constants.ID)); }/*from w ww. j a va 2 s .c o m*/ values.put(status, data.optString(status)); values.put(reply_comment, data.optString(reply_comment)); return values; }
From source file:com.andryr.musicplayer.loaders.AlbumLoader.java
@Override public List<Album> loadInBackground() { mAlbumList = new ArrayList<>(); Cursor cursor = getAlbumCursor(); if (cursor != null && cursor.moveToFirst()) { int idCol = cursor.getColumnIndex(BaseColumns._ID); int albumNameCol = cursor.getColumnIndex(MediaStore.Audio.AlbumColumns.ALBUM); int artistCol = cursor.getColumnIndex(MediaStore.Audio.AlbumColumns.ARTIST); int yearCol = cursor.getColumnIndex(MediaStore.Audio.AlbumColumns.FIRST_YEAR); int songsNbCol = cursor.getColumnIndex(MediaStore.Audio.AlbumColumns.NUMBER_OF_SONGS); do {/*from ww w . ja va 2 s. c o m*/ long id = cursor.getLong(idCol); String name = cursor.getString(albumNameCol); if (name == null || name.equals(MediaStore.UNKNOWN_STRING)) { name = getContext().getString(R.string.unknown_album); id = -1; } String artist = cursor.getString(artistCol); int year = cursor.getInt(yearCol); int count = cursor.getInt(songsNbCol); mAlbumList.add(new Album(id, name, artist, year, count)); } while (cursor.moveToNext()); } if (cursor != null) { cursor.close(); } return mAlbumList; }
From source file:com.dvdprime.mobile.android.adapter.DocumentSuggestionsAdapter.java
public static MatrixCursor getCursor2(String query) { // ? ?? // www .j a v a2 s . co m final String[] COLUMNS = { BaseColumns._ID, SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2 }; MatrixCursor cursor = new MatrixCursor(COLUMNS); cursor.addRow(new Object[] { 1, query, " " }); cursor.addRow(new Object[] { 2, query, "ID " }); cursor.addRow(new Object[] { 4, query, "? " }); cursor.addRow(new Object[] { 7, query, " " }); return cursor; }
From source file:com.espian.ticktock.CountdownFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (getArguments() == null) throw new IllegalArgumentException("No args supplied for fragment"); try {//from w w w .j a va 2 s.c om final Date date = DateFormat.getDateInstance(DateFormat.LONG).parse(getArguments().getString("date")); mIdAsString = getArguments().getString(BaseColumns._ID); mLabelView.setText(mLabel = getArguments().getString("label")); mDateView.setText(DateFormat.getDateInstance(DateFormat.MEDIUM).format(date)); mHelper = new LoadHideHelper(this); new Thread(new Runnable() { @Override public void run() { // Requires an ugly fudge because, for some reason, the Days class accesses // the disk through random access, which throws errors with StrictMode. int days = Days.daysBetween(new DateTime(new Date()), new DateTime(date)).getDays(); Bundle b = new Bundle(); b.putString("result", String.valueOf(days + 1)); Message m = Message.obtain(asyncHandler); m.setData(b); asyncHandler.sendMessage(m); } }).start(); } catch (ParseException e) { Toast.makeText(getActivity(), "Malformed date was stored", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } //getActivity().getLoaderManager().initLoader(TickTockProvider.LOADER_SINGLE_ITEM, getArguments(), this); }
From source file:com.pawnua.android.app.gpstrips.activities.TripLocationListActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_trip_location_list); trip = Trip.getTripByID(getIntent().getLongExtra(BaseColumns._ID, -1)); mFragmentManager = getSupportFragmentManager(); initRecyclerView();/*from w w w .j a v a2 s. c o m*/ final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(getTripTitle(trip)); }