List of usage examples for android.database Cursor getString
String getString(int columnIndex);
From source file:com.almarsoft.GroundhogReader.lib.DBUtils.java
public static String[] getSubscribedGroups(Context context) { DBHelper db = new DBHelper(context); SQLiteDatabase dbread = db.getReadableDatabase(); Cursor cur = dbread.rawQuery("SELECT name FROM subscribed_groups", null); int c = cur.getCount(); String[] subscribed = null;/*from w w w .j a v a 2s.c o m*/ if (c > 0) { subscribed = new String[c]; cur.moveToFirst(); for (int i = 0; i < c; i++) { subscribed[i] = cur.getString(0); cur.moveToNext(); } } cur.close(); dbread.close(); db.close(); return subscribed; }
From source file:net.peterkuterna.android.apps.devoxxfrsched.service.TwitterSearchService.java
@Override protected void doSync(Intent intent) throws Exception { Log.d(TAG, "Refreshing twitter results"); final Cursor c = mResolver.query(Tweets.CONTENT_URI, TweetsQuery.PROJECTION, null, null, null); String tweetId = "0"; try {//from ww w . j a v a 2 s .c om if (c.moveToFirst()) { tweetId = c.getString(TweetsQuery.MAX_TWEET_ID); } } finally { c.close(); } final Uri uri = TwitterApiUriUtils.buildTwitterSearchUri("#devoxxfr +exclude:retweets", tweetId); mRemoteExecutor.executeGet(uri.toString(), new TwitterSearchHandler()); }
From source file:net.peterkuterna.android.apps.devoxxsched.service.TwitterSearchService.java
@Override protected void doSync(Intent intent) throws Exception { Log.d(TAG, "Refreshing twitter results"); final Cursor c = mResolver.query(Tweets.CONTENT_URI, TweetsQuery.PROJECTION, null, null, null); String tweetId = "0"; try {/* w w w. jav a2 s . c om*/ if (c.moveToFirst()) { tweetId = c.getString(TweetsQuery.MAX_TWEET_ID); } } finally { c.close(); } final Uri uri = TwitterApiUriUtils.buildTwitterSearchUri("from:Devoxx OR #devoxx +exclude:retweets", tweetId); mRemoteExecutor.executeGet(uri.toString(), new TwitterSearchHandler()); }
From source file:net.naonedbus.manager.impl.CommentaireManager.java
@Override public Commentaire getSingleFromCursor(final Cursor c) { final Commentaire commentaire = new Commentaire(); commentaire.setId(c.getInt(mColId)); commentaire.setCodeLigne(c.getString(mColCodeLigne)); commentaire.setCodeSens(c.getString(mColCodeSens)); commentaire.setCodeArret(c.getString(mColCodeArret)); commentaire.setMessage(c.getString(mColMessage)); commentaire.setSource(c.getString(mColSource)); commentaire.setTimestamp(c.getLong(mColTimestamp)); return commentaire; }
From source file:com.heneryh.aquanotes.ui.controllers.OutletsDataFragment.java
/** {@inheritDoc} */ @Override/* w w w . ja va2 s . co m*/ public void onListItemClick(ListView l, View v, int position, long id) { final Cursor cursor = (Cursor) mAdapter.getItem(position); final String outletId; outletId = cursor.getString(OutletsDataAdapter.OutletDataViewQuery._ID); }
From source file:com.jpa.JPAApplication.java
public ArrayList<String> getDbAuth() { DbModel db = new DbModel(getApplicationContext()); ArrayList<String> s = new ArrayList<String>(); db.open();/*from ww w.j av a 2 s . com*/ Cursor c = db.getDbAuth(); int urlCol = c.getColumnIndex(DbModel.MetaData.JPA_URL_KEY); int passwordCol = c.getColumnIndex(DbModel.MetaData.JPA_PASSWORD_KEY); c.moveToFirst(); s.add(c.getString(urlCol)); s.add(c.getString(passwordCol)); db.close(); return s; }
From source file:com.almarsoft.GroundhogReader.lib.DBUtils.java
public static HashSet<String> getFavoriteAuthors(Context context) { HashSet<String> favoriteAuthors = null; DBHelper db = new DBHelper(context); SQLiteDatabase dbread = db.getReadableDatabase(); Cursor c = dbread.rawQuery("SELECT name FROM favorite_users", null); if (c.getCount() > 0) { favoriteAuthors = new HashSet<String>(c.getCount()); c.moveToFirst();//from w w w . j a v a 2 s .c om int count = c.getCount(); for (int i = 0; i < count; i++) { favoriteAuthors.add(c.getString(0)); c.moveToNext(); } } c.close(); dbread.close(); db.close(); if (favoriteAuthors == null) favoriteAuthors = new HashSet<String>(0); return favoriteAuthors; }
From source file:net.peterkuterna.android.apps.devoxxfrsched.service.NewsSyncService.java
@Override protected void doSync(Intent intent) throws Exception { Log.d(TAG, "Refreshing DevoxxFr twitter results"); boolean noNotifications = intent.getBooleanExtra(EXTRA_NO_NOTIFICATIONS, false); final Cursor c = mResolver.query(News.CONTENT_URI, NewsQuery.PROJECTION, null, null, null); String newsId = "0"; try {//from ww w . ja v a2 s. com if (c.moveToFirst()) { newsId = c.getString(NewsQuery.MAX_NEWS_ID); } } finally { c.close(); } final Uri uri = TwitterApiUriUtils.buildTwitterSearchUri("from:DevoxxFr +exclude:retweets", newsId); mRemoteExecutor.executeGet(uri.toString(), new NewsHandler(noNotifications)); final NotifierManager notifierManager = new NotifierManager(this); notifierManager.notifyNewNewsItems(); Log.d(TAG, "News sync finished"); }
From source file:com.samknows.measurement.storage.TestResultDataSource.java
private TestResult cursorToTestResult(Cursor cursor) { long id = cursor.getLong(columnIdx.get(SKSQLiteHelper.TR_COLUMN_ID)); String type = cursor.getString(columnIdx.get(SKSQLiteHelper.TR_COLUMN_TYPE)); long dtime = cursor.getLong(columnIdx.get(SKSQLiteHelper.TR_COLUMN_DTIME)); String location = cursor.getString(columnIdx.get(SKSQLiteHelper.TR_COLUMN_LOCATION)); long success = cursor.getLong(columnIdx.get(SKSQLiteHelper.TR_COLUMN_SUCCESS)); double result = cursor.getDouble(columnIdx.get(SKSQLiteHelper.TR_COLUMN_RESULT)); return new TestResult(type, dtime, location, success, result); }
From source file:net.nordist.lloydproof.CorrectionStorage.java
private JSONObject getNextAsJSONObject(Cursor cursor) throws JSONException { JSONObject jobject = new JSONObject(); jobject.put("sync_id", cursor.getInt(0)); jobject.put("current_text", cursor.getString(1)); return jobject; }