List of usage examples for android.database Cursor toString
public String toString()
From source file:com.example.xyzreader.ui.articledetail.ArticleDetailActivity.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { Log.d(LOG_TAG, "onLoadFinished, data = " + data.toString()); mCursor = data;/* w w w .j a v a 2 s. c o m*/ mSectionsPagerAdapter.notifyDataSetChanged(); for (data.moveToFirst(); !data.isAfterLast(); data.moveToNext()) { if (data.getLong(ArticleLoader.Query._ID) == mStartId) { final int position = data.getPosition(); mViewPager.setCurrentItem(position, false); break; } } }
From source file:cc.solart.turbo.BaseCursorAdapter.java
/** * <p>Converts the cursor into a CharSequence. Subclasses should override this * method to convert their results. The default implementation returns an * empty String for null values or the default String representation of * the value.</p>//www. j a v a 2s. co m * * @param cursor the cursor to convert to a CharSequence * @return a CharSequence representing the value */ @Override public CharSequence convertToString(Cursor cursor) { return cursor == null ? "" : cursor.toString(); }
From source file:com.cattle.util.CursorPagerAdapter.java
/** * <p> Converts the cursor into a CharSequence. Subclasses should override this method to convert * their results. The default implementation returns an empty String for null values or the default * String representation of the value. </p> * * @param cursor the cursor to convert to a CharSequence * @return a CharSequence representing the value *///from ww w . j a v a2 s . c o m public CharSequence convertToString(Cursor cursor) { return cursor == null ? "" : cursor.toString(); }
From source file:com.awesome.byunghwa.app.mytvapplication.fragment.MainFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { switch (loader.getId()) { case MY_LOADER_ID_MOVIE_LIST_POPULARITY: LogUtil.log_i(TAG, "onLoadFinished pop entry gets called..."); LogUtil.log_i(TAG, "cursor id: " + cursor.toString()); LogUtil.log_i(TAG, "cursor row count pop entry: " + cursor.getCount()); if (cursor.moveToFirst()) { LogUtil.log_i(TAG, "load pop rows gets called!"); mCardPresenter = new CardPresenter(); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(mCardPresenter); for (int j = 0; j < cursor.getCount(); j++) { cursor.moveToPosition(j); mMovie = new Movie(); mMovie.setTitle(cursor.getString(MoviesLoader.Query.ORIGINAL_TITLE)); String urlNotComplete = cursor.getString(MoviesLoader.Query.POSTER_THUMBNAIL); String urlComplete = "http://image.tmdb.org/t/p/w185/" + urlNotComplete; mMovie.setCardImageUrl(urlComplete); mMovie.setDescription(cursor.getString(MoviesLoader.Query.OVERVIEW)); mMovie.setBackgroundImageUrl(urlComplete); mMovie.setId(cursor.getLong(MoviesLoader.Query.MOVIE_ID)); listRowAdapter.add(mMovie); }//from w w w . j a v a 2s . c o m long headerId = 0; HeaderItem header = new HeaderItem(headerId, sortOrderArrayList[((int) headerId)]); mRowsAdapter.add(new ListRow(header, listRowAdapter)); setAdapter(mRowsAdapter); } getLoaderManager().destroyLoader(loader.getId()); break; case MY_LOADER_ID_MOVIE_LIST_VOTE_AVERAGE: LogUtil.log_i(TAG, "onLoadFinished top rated entry gets called..."); LogUtil.log_i(TAG, "cursor id: " + cursor.toString()); LogUtil.log_i(TAG, "cursor row count top rated entry: " + cursor.getCount()); if (cursor.moveToFirst()) { LogUtil.log_i(TAG, "load top rated rows gets called!"); mCardPresenter = new CardPresenter(); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(mCardPresenter); for (int j = 0; j < cursor.getCount(); j++) { cursor.moveToPosition(j); mMovie = new Movie(); mMovie.setTitle(cursor.getString(MoviesLoader.Query.ORIGINAL_TITLE)); String urlNotComplete = cursor.getString(MoviesLoader.Query.POSTER_THUMBNAIL); String urlComplete = "http://image.tmdb.org/t/p/w185/" + urlNotComplete; mMovie.setCardImageUrl(urlComplete); mMovie.setDescription(cursor.getString(MoviesLoader.Query.OVERVIEW)); mMovie.setBackgroundImageUrl(urlComplete); mMovie.setId(cursor.getLong(MoviesLoader.Query.MOVIE_ID)); listRowAdapter.add(mMovie); } long headerId = 1; HeaderItem header = new HeaderItem(headerId, sortOrderArrayList[((int) headerId)]); mRowsAdapter.add(new ListRow(header, listRowAdapter)); setAdapter(mRowsAdapter); } getLoaderManager().destroyLoader(loader.getId()); break; case MY_LOADER_ID_MOVIE_LIST_FAVORITES: LogUtil.log_i(TAG, "onLoadFinished favorites entry gets called..."); LogUtil.log_i(TAG, "cursor id: " + cursor.toString()); LogUtil.log_i(TAG, "cursor row count fav entry: " + cursor.getCount()); if (cursor.moveToFirst()) { LogUtil.log_i(TAG, "load fav rated rows gets called!"); mCardPresenter = new CardPresenter(); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(mCardPresenter); for (int j = 0; j < cursor.getCount(); j++) { cursor.moveToPosition(j); mMovie = new Movie(); mMovie.setTitle(cursor.getString(MoviesLoader.Query.ORIGINAL_TITLE)); String urlNotComplete = cursor.getString(MoviesLoader.Query.POSTER_THUMBNAIL); String urlComplete = "http://image.tmdb.org/t/p/w185/" + urlNotComplete; mMovie.setCardImageUrl(urlComplete); mMovie.setDescription(cursor.getString(MoviesLoader.Query.OVERVIEW)); mMovie.setBackgroundImageUrl(urlComplete); mMovie.setId(cursor.getLong(MoviesLoader.Query.MOVIE_ID)); listRowAdapter.add(mMovie); } long headerId = 2; HeaderItem header = new HeaderItem(headerId, sortOrderArrayList[((int) headerId)]); mRowsAdapter.add(new ListRow(header, listRowAdapter)); setAdapter(mRowsAdapter); } getLoaderManager().destroyLoader(loader.getId()); break; } }