List of usage examples for android.database Cursor moveToPosition
boolean moveToPosition(int position);
From source file:com.android.transmart.UI.fragments.PlaceListFragment.java
/** * {@inheritDoc}/*from www . ja v a 2s .c om*/ * When a venue is clicked, fetch the details from your server and display the detail page. */ @Override public void onListItemClick(ListView l, View v, int position, long theid) { super.onListItemClick(l, v, position, theid); // Find the ID and Reference of the selected venue. // These are needed to perform a lookup in our cache and the Google Places API server respectively. Cursor c = adapter.getCursor(); c.moveToPosition(position); String reference = c.getString(c.getColumnIndex(PlacesContentProvider.KEY_REFERENCE)); String id = c.getString(c.getColumnIndex(PlacesContentProvider.KEY_ID)); // Initiate a lookup of the venue details usign the PlacesDetailsUpdateService. // Because this is a user initiated action (rather than a prefetch) we request // that the Service force a refresh. Intent serviceIntent = new Intent(activity, PlaceDetailsUpdateService.class); serviceIntent.putExtra(LocationConstants.EXTRA_KEY_REFERENCE, reference); serviceIntent.putExtra(LocationConstants.EXTRA_KEY_ID, id); serviceIntent.putExtra(LocationConstants.EXTRA_KEY_FORCEREFRESH, true); activity.startService(serviceIntent); // Request the parent Activity display the venue detail UI. activity.selectDetail(reference, id); }
From source file:com.radioactiveyak.location_best_practices.UI.fragments.PlaceListFragment.java
/** * {@inheritDoc}//from w w w . j a v a2 s.co m * When a venue is clicked, fetch the details from your server and display the detail page. */ @Override public void onListItemClick(ListView l, View v, int position, long theid) { super.onListItemClick(l, v, position, theid); // Find the ID and Reference of the selected venue. // These are needed to perform a lookup in our cache and the Google Places API server respectively. Cursor c = adapter.getCursor(); c.moveToPosition(position); String reference = c.getString(c.getColumnIndex(PlacesContentProvider.KEY_REFERENCE)); String id = c.getString(c.getColumnIndex(PlacesContentProvider.KEY_ID)); // Initiate a lookup of the venue details usign the PlacesDetailsUpdateService. // Because this is a user initiated action (rather than a prefetch) we request // that the Service force a refresh. Intent serviceIntent = new Intent(activity, PlaceDetailsUpdateService.class); serviceIntent.putExtra(PlacesConstants.EXTRA_KEY_REFERENCE, reference); serviceIntent.putExtra(PlacesConstants.EXTRA_KEY_ID, id); serviceIntent.putExtra(PlacesConstants.EXTRA_KEY_FORCEREFRESH, true); activity.startService(serviceIntent); // Request the parent Activity display the venue detail UI. activity.selectDetail(reference, id); }
From source file:com.zns.comicdroid.adapter.ComicAdapter.java
public int getComicId(int position) { Cursor cursor = getCursor(); if (cursor.moveToPosition(position)) return cursor.getInt(0); return 0;/*from w w w . j a va 2 s.c o m*/ }
From source file:com.zns.comicdroid.adapter.AggregateAdapter.java
public Aggregate getAggregate(int position) { Cursor cursor = getCursor(); if (cursor.moveToPosition(position)) { return new Aggregate(cursor.getInt(0), cursor.getString(1), cursor.getInt(5)); }//from ww w . ja v a 2s .co m return null; }
From source file:org.mozilla.gecko.home.PanelViewAdapter.java
private final Cursor getCursor(int position) { final Cursor cursor = getCursor(); if (cursor == null || !cursor.moveToPosition(position)) { throw new IllegalStateException("Couldn't move cursor to position " + position); }/*from w w w . j ava 2s . c o m*/ return cursor; }
From source file:com.commonsware.android.arXiv.FavouritesListFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Cursor c = adapter.getCursor(); c.moveToPosition(position); String shortTitle = c.getString(c.getColumnIndex(Feeds.SHORTTITLE)); String title = c.getString(c.getColumnIndex(Feeds.TITLE)); String url = c.getString(c.getColumnIndex(Feeds.URL)); Intent intent;/*w w w . jav a 2s . c om*/ if (url.contains("query")) { intent = new Intent(getActivity(), ArticleList.class); intent.putExtra("keyquery", shortTitle); intent.putExtra("keyname", title); } else { intent = new Intent(getActivity(), RSSListWindow.class); intent.putExtra("keyname", shortTitle); } intent.putExtra("keyurl", url); intent.putExtra("feedId", id); intent.putExtra("favorite", true); startActivity(intent); }
From source file:com.getchute.android.photopickerplus.ui.adapter.BaseCursorAdapter.java
@Override public String getItem(int position) { final Cursor cursor = getCursor(); cursor.moveToPosition(position); return cursor.getString(dataIndex); }
From source file:com.mfcoding.locationBP.UI.fragments.LocationListFragment.java
/** * {@inheritDoc}//from ww w. j a v a 2s. co m * When a venue is clicked, fetch the details from your server and display the detail page. */ @Override public void onListItemClick(ListView l, View v, int position, long theid) { super.onListItemClick(l, v, position, theid); Log.d(TAG, "onListItemClick"); // Find the ID and Reference of the selected venue. // These are needed to perform a lookup in our cache and the Google Places API server respectively. Cursor c = adapter.getCursor(); c.moveToPosition(position); // String reference = c.getString(c.getColumnIndex(LocationsContentProvider.KEY_REFERENCE)); // String id = c.getString(c.getColumnIndex(LocationsContentProvider.KEY_ID)); // Initiate a lookup of the venue details usign the PlacesDetailsUpdateService. // Because this is a user initiated action (rather than a prefetch) we request // that the Service force a refresh. // Intent serviceIntent = new Intent(activity, LocationDetailsUpdateService.class); // serviceIntent.putExtra(LocationsConstants.EXTRA_KEY_REFERENCE, reference); // serviceIntent.putExtra(LocationsConstants.EXTRA_KEY_ID, id); // serviceIntent.putExtra(LocationsConstants.EXTRA_KEY_FORCEREFRESH, true); // activity.startService(serviceIntent); // Request the parent Activity display the venue detail UI. // activity.selectDetail(reference, id); }
From source file:ro.expectations.expenses.ui.categories.SubcategoriesActivity.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (data.getCount() > 0) { data.moveToPosition(0); String categoryName = data.getString(data.getColumnIndex(ExpensesContract.Categories.NAME)); setTitle(categoryName);// www.ja va2 s . com getSupportActionBar().setDisplayShowTitleEnabled(true); } }
From source file:com.commonsware.android.passwordbox.RosterFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { Cursor c = ((CursorAdapter) getListAdapter()).getCursor(); c.moveToPosition(position); getActivityContract().showPassphrase(c.getInt(DatabaseHelper.SELECT_ALL_ID), c.getString(DatabaseHelper.SELECT_ALL_TITLE), c.getString(DatabaseHelper.SELECT_ALL_PASSPHRASE)); }