List of usage examples for android.database Cursor getColumnIndex
int getColumnIndex(String columnName);
From source file:com.jaspersoft.android.jaspermobile.util.SavedItemHelper.java
private String getExtension(Uri recordUri) { Cursor cursor = context.getContentResolver().query(recordUri, null, null, null, null); if (cursor == null || !cursor.moveToFirst()) return null; String extension = cursor.getString(cursor.getColumnIndex(SavedItemsTable.FILE_FORMAT)); cursor.close();//from w ww .j a v a 2 s. com return extension; }
From source file:com.kynetx.api.java
public void setApp(Cursor apps) { appId = "";/* w w w.ja v a2 s . co m*/ appVersions = ""; apps.moveToFirst(); while (apps.isAfterLast() == false) { if (!apps.getString(apps.getColumnIndex(KynetxSQLHelper.KEY_VERSION)).equals("none")) { appId += apps.getString(apps.getColumnIndex(KynetxSQLHelper.KEY_APPID)); appVersions += appId + ":kynetx_app_version=" + apps.getString(apps.getColumnIndex(KynetxSQLHelper.KEY_VERSION)) + "&"; if (!apps.isLast()) { appId += ";"; } } apps.moveToNext(); } apps.close(); }
From source file:com.jaspersoft.android.jaspermobile.util.SavedItemHelper.java
private File getFile(Uri recordUri) { Cursor cursor = context.getContentResolver().query(recordUri, null, null, null, null); if (cursor == null || !cursor.moveToFirst()) return null; File file = new File(cursor.getString(cursor.getColumnIndex(SavedItemsTable.FILE_PATH))); cursor.close();//w w w .ja va 2 s .c o m return file; }
From source file:com.crankworks.cycletracks.TripUploader.java
private Vector<String> getTripData(long tripId) { Vector<String> tripData = new Vector<String>(); mDb.openReadOnly();//from www. ja v a 2 s. c o m Cursor tripCursor = mDb.fetchTrip(tripId); String note = tripCursor.getString(tripCursor.getColumnIndex(DbAdapter.K_TRIP_NOTE)); String purpose = tripCursor.getString(tripCursor.getColumnIndex(DbAdapter.K_TRIP_PURP)); Double startTime = tripCursor.getDouble(tripCursor.getColumnIndex(DbAdapter.K_TRIP_START)); Double endTime = tripCursor.getDouble(tripCursor.getColumnIndex(DbAdapter.K_TRIP_END)); tripCursor.close(); mDb.close(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); tripData.add(note); tripData.add(purpose); tripData.add(df.format(startTime)); tripData.add(df.format(endTime)); return tripData; }
From source file:src.com.nustats.pacelogger.TripUploader.java
private Vector<String> getTripData(long tripId) { Vector<String> tripData = new Vector<String>(); mDb.openReadOnly();/*from w ww . j a va 2s.co m*/ Cursor tripCursor = mDb.fetchTrip(tripId); String note = tripCursor.getString(tripCursor.getColumnIndex(DbAdapter.K_TRIP_NOTE)); String purpose = tripCursor.getString(tripCursor.getColumnIndex(DbAdapter.K_TRIP_PURP)); Double startTime = tripCursor.getDouble(tripCursor.getColumnIndex(DbAdapter.K_TRIP_START)); Double endTime = tripCursor.getDouble(tripCursor.getColumnIndex(DbAdapter.K_TRIP_END)); tripCursor.close(); mDb.close(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); tripData.add(note); tripData.add(purpose); tripData.add(df.format(startTime)); tripData.add(df.format(endTime)); return tripData; }
From source file:com.textuality.lifesaver2.Columns.java
private void setColumns(Cursor cursor) { if (mColumns != null) return;//from w ww. ja v a2 s . co m mColumns = new int[mNames.length]; for (int i = 0; i < mNames.length; i++) mColumns[i] = cursor.getColumnIndex(mNames[i]); }
From source file:com.phicomm.account.operator.UploadContactOperation.java
@Override public Bundle execute(Context context, Request request) { //read upload table //xml/*from w ww . jav a 2 s .c om*/ //upload to service -- ok String ssession_id = null; String user_key = null; String user_name = null; String xmlDoc = null; String sync_time = null; Bundle resultData = new Bundle(); Cursor persionCursor = context.getContentResolver().query(Provider.PersonColumns.CONTENT_URI, null, null, null, null); if (persionCursor != null) { if (persionCursor.moveToFirst()) { ssession_id = persionCursor .getString(persionCursor.getColumnIndex(Provider.PersonColumns.JSSESSIONID)); user_key = persionCursor.getString(persionCursor.getColumnIndex(Provider.PersonColumns.USER_KEY)); user_name = persionCursor.getString(persionCursor.getColumnIndex(Provider.PersonColumns.NAME)); sync_time = persionCursor.getString(persionCursor.getColumnIndex(Provider.PersonColumns.SYNC_TIME)); } persionCursor.close(); } //mode xmlDoc. ContactUpload upload = new ContactUpload(); UploadDataOperate uploadOperate = new UploadDataOperate(context); Log.i("ss", "_____upload :" + uploadOperate.judgeUploadDataExist()); if (uploadOperate.judgeUploadDataExist()) { ArrayList<Contact> updataValues = upload.getUploadContactList(context); xmlDoc = NetworkUtilities.modContactToXml(updataValues, user_name, user_key, sync_time); } String url = WSConfig.WS_SYNC_CONTACT_URL + ssession_id; NetworkConnection networkConnection1 = new NetworkConnection(context, url); ArrayList<BasicNameValuePair> parameterList = new ArrayList<BasicNameValuePair>(); BasicNameValuePair value = new BasicNameValuePair("XML", xmlDoc); parameterList.add(value); networkConnection1.setParameters(parameterList); try { ConnectionResult result = networkConnection1.execute(); resultData.putString("result", result.body); Log.i("ss", "________________________________result.body:" + result.body); } catch (ConnectionException e) { e.printStackTrace(); } Log.i("ss", "_______________________________________OK"); return resultData; }
From source file:com.panoskrt.dbadapter.DBAdapter.java
public int getIntEntry(String column, String table, String match) { int number = 0; Cursor c = database.rawQuery("SELECT " + column + " FROM " + table + " WHERE " + column + "=" + match, null);/*from w w w .j av a 2s.c om*/ if (c != null) { if (c.moveToFirst()) { number = c.getInt(c.getColumnIndex(column)); } } return number; }
From source file:com.panoskrt.dbadapter.DBAdapter.java
public long getLongEntry(String column, String table, String match) { long number = 0; Cursor c = database.rawQuery("SELECT " + column + " FROM " + table + " WHERE " + column + "=" + match, null);//from w ww.j ava 2 s .com if (c != null) { if (c.moveToFirst()) { number = c.getInt(c.getColumnIndex(column)); } } return number; }
From source file:com.panoskrt.dbadapter.DBAdapter.java
public double getDoubleEntry(String column, String table, String match) { double number = 0; Cursor c = database.rawQuery("SELECT " + column + " FROM " + table + " WHERE " + column + "=" + match, null);//w ww.j a v a 2 s.c om if (c != null) { if (c.moveToFirst()) { number = c.getInt(c.getColumnIndex(column)); } } return number; }