Java Code Examples for android.provider.BaseColumns

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Airports, under directory /src/com/nadmm/airports/afd/.

Source file: BrowseActivity.java

  15 
vote

static HashMap<String,String> buildStateMap(){
  HashMap<String,String> map=new HashMap<String,String>();
  map.put(BaseColumns._ID,"max(" + BaseColumns._ID + ") AS "+ BaseColumns._ID);
  map.put(Airports.ASSOC_STATE,Airports.ASSOC_STATE);
  map.put(States.STATE_NAME,"IFNULL(" + States.STATE_NAME + ", "+ Airports.ASSOC_COUNTY+ ")"+ " AS "+ States.STATE_NAME);
  return map;
}
 

Example 2

From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/data/.

Source file: CategoryProvider.java

  15 
vote

@Override public Cursor query(Uri uri,String[] projection,String selection,String[] selectionArgs,String sortOrder){
  JSONArray array=new JSONArray();
  try {
    String categoryId=JsonData.VALUE_NULL;
switch (uriMatcher.match(uri)) {
case CATEGORIES_ID:
      categoryId=uri.getLastPathSegment();
case CATEGORIES:
    JSONObject parent=categories.getJSONObject(categoryId);
  if (parent.has(JsonData.PARAM_CATEGORY_CHILDREN)) {
    JSONArray subset=parent.getJSONArray(JsonData.PARAM_CATEGORY_CHILDREN);
    for (int i=0; i < subset.length(); i++) {
      JSONObject obj=categories.getJSONObject(subset.getString(i));
      obj.put(BaseColumns._ID,(long)Integer.valueOf(subset.getString(i)));
      array.put(obj);
    }
  }
break;
case CATEGORY_ID:
categoryId=uri.getLastPathSegment();
array.put(categories.getJSONObject(categoryId));
Log.d(Constants.PROJECT_TAG,"category returned = " + categories.getJSONObject(categoryId));
break;
default :
return null;
}
}
 catch (NumberFormatException e) {
e.printStackTrace();
}
catch (JSONException e) {
e.printStackTrace();
}
Cursor c=new JSONCursor(array,projection);
if (c != null) c.setNotificationUri(getContext().getContentResolver(),uri);
return c;
}
 

Example 3

From project android-client_1, under directory /src/com/buddycloud/content/.

Source file: ChannelDataHelper.java

  15 
vote

public static int update(ContentValues values,String selection,String[] selectionArgs,BuddycloudProvider provider){
  values.put(CacheColumns.CACHE_UPDATE_TIMESTAMP,System.currentTimeMillis());
  values.remove(BaseColumns._ID);
  boolean notifyRoster=false;
  boolean notify=false;
  int count=-1;
  SQLiteDatabase database=provider.getDatabase();
synchronized (database) {
    try {
      database.beginTransaction();
      count=database.update(BuddycloudProvider.TABLE_CHANNEL_DATA,values,selection,selectionArgs);
      if (count >= 1 && values.containsKey(ChannelData.UNREAD) && !values.getAsBoolean(ChannelData.UNREAD) && values.size() == 2) {
        Cursor c=database.query(BuddycloudProvider.TABLE_CHANNEL_DATA,ChannelData.PROJECTION_MAP,selection,selectionArgs,null,null,null);
        if (c.moveToFirst()) {
          String channel=c.getString(c.getColumnIndex(ChannelData.NODE_NAME));
          RosterHelper.recomputeUnread(channel,provider,database);
          notifyRoster=true;
        }
        c.close();
      }
      notify=true;
      database.setTransactionSuccessful();
    }
  finally {
      try {
        database.endTransaction();
      }
 catch (      Exception e) {
      }
    }
    if (notify) {
      notifyChange(provider);
    }
    if (notifyRoster) {
      RosterHelper.notifyChange(provider);
      BCNotifications.updateNotification(provider);
    }
  }
  return count;
}
 

Example 4

From project android-database-sqlcipher, under directory /src/net/sqlcipher/database/.

Source file: SQLiteQueryBuilder.java

  15 
vote

private String[] computeProjection(String[] projectionIn){
  if (projectionIn != null && projectionIn.length > 0) {
    if (mProjectionMap != null) {
      String[] projection=new String[projectionIn.length];
      int length=projectionIn.length;
      for (int i=0; i < length; i++) {
        String userColumn=projectionIn[i];
        String column=mProjectionMap.get(userColumn);
        if (column != null) {
          projection[i]=column;
          continue;
        }
        if (!mStrictProjectionMap && (userColumn.contains(" AS ") || userColumn.contains(" as "))) {
          projection[i]=userColumn;
          continue;
        }
        throw new IllegalArgumentException("Invalid column " + projectionIn[i]);
      }
      return projection;
    }
 else {
      return projectionIn;
    }
  }
 else   if (mProjectionMap != null) {
    Set<Entry<String,String>> entrySet=mProjectionMap.entrySet();
    String[] projection=new String[entrySet.size()];
    Iterator<Entry<String,String>> entryIter=entrySet.iterator();
    int i=0;
    while (entryIter.hasNext()) {
      Entry<String,String> entry=entryIter.next();
      if (entry.getKey().equals(BaseColumns._COUNT)) {
        continue;
      }
      projection[i++]=entry.getValue();
    }
    return projection;
  }
  return null;
}
 

Example 5

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/core/model/persistence/.

Source file: AbstractEntityPersister.java

  15 
vote

@Override public E findById(Id localId){
  E entity=null;
  if (localId.isInitialised()) {
    Cursor cursor=mResolver.query(getContentUri(),getFullProjection(),BaseColumns._ID + " = ?",new String[]{localId.toString()},null);
    if (cursor.moveToFirst()) {
      entity=read(cursor);
    }
    cursor.close();
  }
  return entity;
}
 

Example 6

From project android_packages_apps_cmparts, under directory /src/com/cyanogenmod/cmparts/activities/.

Source file: LockscreenWidgetsActivity.java

  15 
vote

static CalendarEntries findCalendars(ContentResolver contentResolver){
  List<CharSequence> entries=new ArrayList<CharSequence>();
  List<CharSequence> entryValues=new ArrayList<CharSequence>();
  Cursor cursor=null;
  try {
    cursor=Calendar.Calendars.query(contentResolver,new String[]{Calendar.Calendars.DISPLAY_NAME,BaseColumns._ID},CALENDARS_WHERE,null);
    while (cursor.moveToNext()) {
      String entry=cursor.getString(0);
      entries.add(entry);
      String entryValue=cursor.getString(1);
      entryValues.add(entryValue);
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return new CalendarEntries(entries,entryValues);
}
 

Example 7

From project AquaNotesTest, under directory /src/com/google/android/apps/iosched/provider/.

Source file: ScheduleDatabase.java

  15 
vote

@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("CREATE TABLE " + Tables.BLOCKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ BlocksColumns.BLOCK_ID+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_TITLE+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_START+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_END+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_TYPE+ " TEXT,"+ "UNIQUE ("+ BlocksColumns.BLOCK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ TracksColumns.TRACK_ID+ " TEXT NOT NULL,"+ TracksColumns.TRACK_NAME+ " TEXT,"+ TracksColumns.TRACK_COLOR+ " INTEGER,"+ TracksColumns.TRACK_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ TracksColumns.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.ROOMS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ RoomsColumns.ROOM_ID+ " TEXT NOT NULL,"+ RoomsColumns.ROOM_NAME+ " TEXT,"+ RoomsColumns.ROOM_FLOOR+ " TEXT,"+ "UNIQUE ("+ RoomsColumns.ROOM_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SessionsColumns.SESSION_ID+ " TEXT NOT NULL,"+ Sessions.BLOCK_ID+ " TEXT "+ References.BLOCK_ID+ ","+ Sessions.ROOM_ID+ " TEXT "+ References.ROOM_ID+ ","+ SessionsColumns.SESSION_LEVEL+ " TEXT,"+ SessionsColumns.SESSION_TITLE+ " TEXT,"+ SessionsColumns.SESSION_ABSTRACT+ " TEXT,"+ SessionsColumns.SESSION_REQUIREMENTS+ " TEXT,"+ SessionsColumns.SESSION_KEYWORDS+ " TEXT,"+ SessionsColumns.SESSION_HASHTAG+ " TEXT,"+ SessionsColumns.SESSION_SLUG+ " TEXT,"+ SessionsColumns.SESSION_URL+ " TEXT,"+ SessionsColumns.SESSION_MODERATOR_URL+ " TEXT,"+ SessionsColumns.SESSION_YOUTUBE_URL+ " TEXT,"+ SessionsColumns.SESSION_PDF_URL+ " TEXT,"+ SessionsColumns.SESSION_FEEDBACK_URL+ " TEXT,"+ SessionsColumns.SESSION_NOTES_URL+ " TEXT,"+ SessionsColumns.SESSION_STARRED+ " INTEGER NOT NULL DEFAULT 0,"+ "UNIQUE ("+ SessionsColumns.SESSION_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SpeakersColumns.SPEAKER_ID+ " TEXT NOT NULL,"+ SpeakersColumns.SPEAKER_NAME+ " TEXT,"+ SpeakersColumns.SPEAKER_IMAGE_URL+ " TEXT,"+ SpeakersColumns.SPEAKER_COMPANY+ " TEXT,"+ SpeakersColumns.SPEAKER_ABSTRACT+ " TEXT,"+ SpeakersColumns.SPEAKER_URL+ " TEXT,"+ "UNIQUE ("+ SpeakersColumns.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsSpeakers.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ " TEXT NOT NULL "+ References.SPEAKER_ID+ ","+ "UNIQUE ("+ SessionsSpeakers.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsTracks.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ " TEXT NOT NULL "+ References.TRACK_ID+ ","+ "UNIQUE ("+ SessionsTracks.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.VENDORS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ VendorsColumns.VENDOR_ID+ " TEXT NOT NULL,"+ Vendors.TRACK_ID+ " TEXT "+ References.TRACK_ID+ ","+ VendorsColumns.VENDOR_NAME+ " TEXT,"+ VendorsColumns.VENDOR_LOCATION+ " TEXT,"+ VendorsColumns.VENDOR_DESC+ " TEXT,"+ VendorsColumns.VENDOR_URL+ " TEXT,"+ VendorsColumns.VENDOR_PRODUCT_DESC+ " TEXT,"+ VendorsColumns.VENDOR_LOGO_URL+ " TEXT,"+ VendorsColumns.VENDOR_STARRED+ " INTEGER,"+ "UNIQUE ("+ VendorsColumns.VENDOR_ID+ ") ON CONFLICT REPLACE)");
  createSessionsSearch(db);
  createVendorsSearch(db);
  db.execSQL("CREATE TABLE " + Tables.SEARCH_SUGGEST + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SearchManager.SUGGEST_COLUMN_TEXT_1+ " TEXT NOT NULL)");
}
 

Example 8

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/.

Source file: ExchangeRatesProvider.java

  15 
vote

@Override public Cursor query(final Uri uri,final String[] projection,final String selection,final String[] selectionArgs,final String sortOrder){
  final long now=System.currentTimeMillis();
  if (exchangeRates == null || now - lastUpdated > UPDATE_FREQ_MS) {
    final Map<String,Double> newExchangeRates=getExchangeRates();
    if (newExchangeRates != null) {
      exchangeRates=newExchangeRates;
      lastUpdated=now;
    }
  }
  if (exchangeRates == null)   return null;
  final MatrixCursor cursor=new MatrixCursor(new String[]{BaseColumns._ID,KEY_CURRENCY_CODE,KEY_EXCHANGE_RATE});
  if (selection == null) {
    for (    final Map.Entry<String,Double> entry : exchangeRates.entrySet())     cursor.newRow().add(entry.getKey().hashCode()).add(entry.getKey()).add(entry.getValue());
  }
 else   if (selection.equals(KEY_CURRENCY_CODE)) {
    final String code=selectionArgs[0];
    final Double rate=exchangeRates.get(code);
    cursor.newRow().add(code.hashCode()).add(code).add(rate);
  }
  return cursor;
}
 

Example 9

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: CatalogueDBAdapter.java

  15 
vote

/** 
 * @param query The query string
 * @return Cursor of search suggestions
 */
public Cursor fetchSearchSuggestions(String query){
  String sql="Select * From (SELECT \"BK\" || b." + KEY_ROWID + " as "+ BaseColumns._ID+ ", b."+ KEY_TITLE+ " as "+ SearchManager.SUGGEST_COLUMN_TEXT_1+ ", b."+ KEY_TITLE+ " as "+ SearchManager.SUGGEST_COLUMN_INTENT_DATA+ " FROM "+ DB_TB_BOOKS+ " b"+ " WHERE b."+ KEY_TITLE+ " LIKE '"+ query+ "%'"+ " UNION "+ " SELECT \"AF\" || a."+ KEY_ROWID+ " as "+ BaseColumns._ID+ ", a."+ KEY_FAMILY_NAME+ " as "+ SearchManager.SUGGEST_COLUMN_TEXT_1+ ", a."+ KEY_FAMILY_NAME+ " as "+ SearchManager.SUGGEST_COLUMN_INTENT_DATA+ " FROM "+ DB_TB_AUTHORS+ " a"+ " WHERE a."+ KEY_FAMILY_NAME+ " LIKE '"+ query+ "%'"+ " UNION "+ " SELECT \"AG\" || a."+ KEY_ROWID+ " as "+ BaseColumns._ID+ ", a."+ KEY_GIVEN_NAMES+ " as "+ SearchManager.SUGGEST_COLUMN_TEXT_1+ ", a."+ KEY_GIVEN_NAMES+ " as "+ SearchManager.SUGGEST_COLUMN_INTENT_DATA+ " FROM "+ DB_TB_AUTHORS+ " a"+ " WHERE a."+ KEY_GIVEN_NAMES+ " LIKE '"+ query+ "%'"+ " UNION "+ " SELECT \"BK\" || b."+ KEY_ROWID+ " as "+ BaseColumns._ID+ ", b."+ KEY_ISBN+ " as "+ SearchManager.SUGGEST_COLUMN_TEXT_1+ ", b."+ KEY_ISBN+ " as "+ SearchManager.SUGGEST_COLUMN_INTENT_DATA+ " FROM "+ DB_TB_BOOKS+ " b"+ " WHERE b."+ KEY_ISBN+ " LIKE '"+ query+ "%'"+ " ) as zzz "+ " ORDER BY Upper("+ SearchManager.SUGGEST_COLUMN_TEXT_1+ ") "+ COLLATION;
  ;
  Cursor results=mDb.rawQuery(sql,null);
  return results;
}
 

Example 10

From project com.juick.android, under directory /src/com/juick/android/.

Source file: ContactsSyncService.java

  15 
vote

private static void performSync(Context context,Account account,Bundle extras,String authority,ContentProviderClient provider,SyncResult syncResult) throws OperationCanceledException {
  HashMap<String,Long> localContacts=new HashMap<String,Long>();
  mContentResolver=context.getContentResolver();
  Uri rawContactUri=RawContacts.CONTENT_URI.buildUpon().appendQueryParameter(RawContacts.ACCOUNT_NAME,account.name).appendQueryParameter(RawContacts.ACCOUNT_TYPE,account.type).build();
  Cursor c1=mContentResolver.query(rawContactUri,new String[]{BaseColumns._ID,RawContacts.SYNC1},null,null,null);
  while (c1.moveToNext()) {
    localContacts.put(c1.getString(1),c1.getLong(0));
  }
  final String jsonStr=Utils.getJSON(context,"http://api.juick.com/users/friends");
  if (jsonStr != null && jsonStr.length() > 4) {
    try {
      JSONArray json=new JSONArray(jsonStr);
      int cnt=json.length();
      for (int i=0; i < cnt; i++) {
        JuickUser user=JuickUser.parseJSON(json.getJSONObject(i));
        if (!localContacts.containsKey(user.UName)) {
          addContact(context,account,user);
        }
      }
    }
 catch (    JSONException e) {
    }
  }
}
 

Example 11

From project conference-mobile-app, under directory /android-app/src/com/google/android/apps/iosched/provider/.

Source file: ScheduleDatabase.java

  15 
vote

@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("CREATE TABLE " + Tables.BLOCKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ BlocksColumns.BLOCK_ID+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_TITLE+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_START+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_END+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_TYPE+ " TEXT,"+ "UNIQUE ("+ BlocksColumns.BLOCK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ TracksColumns.TRACK_ID+ " TEXT NOT NULL,"+ TracksColumns.TRACK_NAME+ " TEXT,"+ TracksColumns.TRACK_COLOR+ " INTEGER,"+ TracksColumns.TRACK_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ TracksColumns.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.ROOMS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ RoomsColumns.ROOM_ID+ " TEXT NOT NULL,"+ RoomsColumns.ROOM_NAME+ " TEXT,"+ RoomsColumns.ROOM_FLOOR+ " TEXT,"+ "UNIQUE ("+ RoomsColumns.ROOM_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SessionsColumns.SESSION_ID+ " TEXT NOT NULL,"+ Sessions.BLOCK_ID+ " TEXT "+ References.BLOCK_ID+ ","+ Sessions.ROOM_ID+ " TEXT "+ References.ROOM_ID+ ","+ SessionsColumns.SESSION_LEVEL+ " TEXT,"+ SessionsColumns.SESSION_TITLE+ " TEXT,"+ SessionsColumns.SESSION_ABSTRACT+ " TEXT,"+ SessionsColumns.SESSION_REQUIREMENTS+ " TEXT,"+ SessionsColumns.SESSION_KEYWORDS+ " TEXT,"+ SessionsColumns.SESSION_HASHTAG+ " TEXT,"+ SessionsColumns.SESSION_SLUG+ " TEXT,"+ SessionsColumns.SESSION_URL+ " TEXT,"+ SessionsColumns.SESSION_MODERATOR_URL+ " TEXT,"+ SessionsColumns.SESSION_YOUTUBE_URL+ " TEXT,"+ SessionsColumns.SESSION_PDF_URL+ " TEXT,"+ SessionsColumns.SESSION_FEEDBACK_URL+ " TEXT,"+ SessionsColumns.SESSION_NOTES_URL+ " TEXT,"+ SessionsColumns.SESSION_STARRED+ " INTEGER NOT NULL DEFAULT 0,"+ "UNIQUE ("+ SessionsColumns.SESSION_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SpeakersColumns.SPEAKER_ID+ " TEXT NOT NULL,"+ SpeakersColumns.SPEAKER_NAME+ " TEXT,"+ SpeakersColumns.SPEAKER_IMAGE_URL+ " TEXT,"+ SpeakersColumns.SPEAKER_COMPANY+ " TEXT,"+ SpeakersColumns.SPEAKER_ABSTRACT+ " TEXT,"+ SpeakersColumns.SPEAKER_URL+ " TEXT,"+ "UNIQUE ("+ SpeakersColumns.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsSpeakers.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ " TEXT NOT NULL "+ References.SPEAKER_ID+ ","+ "UNIQUE ("+ SessionsSpeakers.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsTracks.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ " TEXT NOT NULL "+ References.TRACK_ID+ ","+ "UNIQUE ("+ SessionsTracks.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.VENDORS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ VendorsColumns.VENDOR_ID+ " TEXT NOT NULL,"+ Vendors.TRACK_ID+ " TEXT "+ References.TRACK_ID+ ","+ VendorsColumns.VENDOR_NAME+ " TEXT,"+ VendorsColumns.VENDOR_LOCATION+ " TEXT,"+ VendorsColumns.VENDOR_DESC+ " TEXT,"+ VendorsColumns.VENDOR_URL+ " TEXT,"+ VendorsColumns.VENDOR_PRODUCT_DESC+ " TEXT,"+ VendorsColumns.VENDOR_LOGO_URL+ " TEXT,"+ VendorsColumns.VENDOR_STARRED+ " INTEGER,"+ "UNIQUE ("+ VendorsColumns.VENDOR_ID+ ") ON CONFLICT REPLACE)");
  createSessionsSearch(db);
  createVendorsSearch(db);
  db.execSQL("CREATE TABLE " + Tables.SEARCH_SUGGEST + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SearchManager.SUGGEST_COLUMN_TEXT_1+ " TEXT NOT NULL)");
}
 

Example 12

From project COSsettings, under directory /src/com/cyanogenmod/cmparts/activities/.

Source file: LockscreenWidgetsActivity.java

  15 
vote

static CalendarEntries findCalendars(ContentResolver contentResolver){
  List<CharSequence> entries=new ArrayList<CharSequence>();
  List<CharSequence> entryValues=new ArrayList<CharSequence>();
  Cursor cursor=null;
  try {
    cursor=Calendar.Calendars.query(contentResolver,new String[]{Calendar.Calendars.DISPLAY_NAME,BaseColumns._ID},CALENDARS_WHERE,null);
    while (cursor.moveToNext()) {
      String entry=cursor.getString(0);
      entries.add(entry);
      String entryValue=cursor.getString(1);
      entryValues.add(entryValue);
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return new CalendarEntries(entries,entryValues);
}
 

Example 13

From project danbooru-gallery-android, under directory /src/tw/idv/palatis/danboorugallery/.

Source file: TagProvider.java

  15 
vote

Cursor getSuggestions(String query){
  query=query.toLowerCase();
  D.Log.i("TagProvider::getSuggestions(): query = %s",query);
  if (SiteAPI.getInstance() == null)   SiteAPI.readPreference(preferences);
  List<Tag> tags=SiteAPI.getInstance().fetchTagsIndex(1,query,300);
  List<ResultSet> results=new ArrayList<ResultSet>(tags.size());
  if (tags.size() > 0) {
    String keywords[]=query.split("\\+");
    for (    Tag tag : tags)     results.add(new ResultSet(tag,""));
    for (    String keyword : keywords) {
      keyword=keyword.trim().replace(' ','_');
      for (      ResultSet result : results)       if (result.tag.name.contains(keyword))       result.keywords+=", " + keyword;
    }
    for (    ResultSet result : results)     result.keywords=result.keywords.substring(2);
    Collections.sort(results,new ResultSet.CompareName());
    Collections.sort(results,new ResultSet.CompareCount());
    Collections.sort(results,new ResultSet.CompareKeywords());
  }
  int length=results.size();
  MatrixCursor cursor=new MatrixCursor(new String[]{BaseColumns._ID,SearchManager.SUGGEST_COLUMN_TEXT_1,SearchManager.SUGGEST_COLUMN_TEXT_2,SearchManager.SUGGEST_COLUMN_INTENT_DATA},length);
  for (  ResultSet result : results)   cursor.addRow(new Object[]{result.tag.id,result.tag.name,String.format(getContext().getString(R.string.search_suggestion_description),result.tag.count,result.keywords),result.tag.name});
  return cursor;
}
 

Example 14

From project dccsched, under directory /src/com/underhilllabs/dccsched/provider/.

Source file: ScheduleDatabase.java

  15 
vote

@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("CREATE TABLE " + Tables.BLOCKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ BlocksColumns.BLOCK_ID+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_TITLE+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_START+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_END+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_TYPE+ " TEXT,"+ "UNIQUE ("+ BlocksColumns.BLOCK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ TracksColumns.TRACK_ID+ " TEXT NOT NULL,"+ TracksColumns.TRACK_NAME+ " TEXT,"+ TracksColumns.TRACK_COLOR+ " INTEGER,"+ TracksColumns.TRACK_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ TracksColumns.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.ROOMS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ RoomsColumns.ROOM_ID+ " TEXT NOT NULL,"+ RoomsColumns.ROOM_NAME+ " TEXT,"+ RoomsColumns.ROOM_FLOOR+ " TEXT,"+ "UNIQUE ("+ RoomsColumns.ROOM_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SessionsColumns.SESSION_ID+ " TEXT NOT NULL,"+ Sessions.BLOCK_ID+ " TEXT "+ References.BLOCK_ID+ ","+ Sessions.ROOM_ID+ " TEXT "+ References.ROOM_ID+ ","+ SessionsColumns.TYPE+ " TEXT,"+ SessionsColumns.TITLE+ " TEXT,"+ SessionsColumns.ABSTRACT+ " TEXT,"+ SessionsColumns.REQUIREMENTS+ " TEXT,"+ SessionsColumns.MODERATOR_URL+ " TEXT,"+ SessionsColumns.WAVE_URL+ " TEXT,"+ SessionsColumns.KEYWORDS+ " TEXT,"+ SessionsColumns.HASHTAG+ " TEXT,"+ SessionsColumns.STARRED+ " INTEGER NOT NULL DEFAULT 0,"+ "UNIQUE ("+ SessionsColumns.SESSION_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SpeakersColumns.SPEAKER_ID+ " TEXT NOT NULL,"+ SpeakersColumns.SPEAKER_NAME+ " TEXT,"+ SpeakersColumns.SPEAKER_COMPANY+ " TEXT,"+ SpeakersColumns.SPEAKER_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ SpeakersColumns.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsSpeakers.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ " TEXT NOT NULL "+ References.SPEAKER_ID+ ","+ "UNIQUE ("+ SessionsSpeakers.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsTracks.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ " TEXT NOT NULL "+ References.TRACK_ID+ ","+ "UNIQUE ("+ SessionsTracks.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.VENDORS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ VendorsColumns.VENDOR_ID+ " TEXT NOT NULL,"+ Vendors.TRACK_ID+ " TEXT "+ References.TRACK_ID+ ","+ VendorsColumns.NAME+ " TEXT,"+ VendorsColumns.LOCATION+ " TEXT,"+ VendorsColumns.DESC+ " TEXT,"+ VendorsColumns.URL+ " TEXT,"+ VendorsColumns.PRODUCT_DESC+ " TEXT,"+ VendorsColumns.LOGO_URL+ " TEXT,"+ VendorsColumns.LOGO+ " BLOB DEFAULT NULL,"+ VendorsColumns.STARRED+ " INTEGER,"+ "UNIQUE ("+ VendorsColumns.VENDOR_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.NOTES + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ Notes.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ NotesColumns.NOTE_TIME+ " INTEGER NOT NULL,"+ NotesColumns.NOTE_CONTENT+ " TEXT)");
  createSessionsSearch(db);
  createVendorsSearch(db);
  db.execSQL("CREATE TABLE " + Tables.SEARCH_SUGGEST + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SearchManager.SUGGEST_COLUMN_TEXT_1+ " TEXT NOT NULL)");
}
 

Example 15

From project dcnyc10-android, under directory /android/src/com/lullabot/android/apps/iosched/provider/.

Source file: ScheduleDatabase.java

  15 
vote

@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("CREATE TABLE " + Tables.BLOCKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ BlocksColumns.BLOCK_ID+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_TITLE+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_START+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_END+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_TYPE+ " TEXT,"+ "UNIQUE ("+ BlocksColumns.BLOCK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ TracksColumns.TRACK_ID+ " TEXT NOT NULL,"+ TracksColumns.TRACK_NAME+ " TEXT,"+ TracksColumns.TRACK_COLOR+ " INTEGER,"+ TracksColumns.TRACK_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ TracksColumns.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.ROOMS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ RoomsColumns.ROOM_ID+ " TEXT NOT NULL,"+ RoomsColumns.ROOM_NAME+ " TEXT,"+ RoomsColumns.ROOM_FLOOR+ " TEXT,"+ "UNIQUE ("+ RoomsColumns.ROOM_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SessionsColumns.SESSION_ID+ " TEXT NOT NULL,"+ Sessions.BLOCK_ID+ " TEXT "+ References.BLOCK_ID+ ","+ Sessions.ROOM_ID+ " TEXT "+ References.ROOM_ID+ ","+ SessionsColumns.SESSION_LEVEL+ " TEXT,"+ SessionsColumns.SESSION_TITLE+ " TEXT,"+ SessionsColumns.SESSION_ABSTRACT+ " TEXT,"+ SessionsColumns.SESSION_REQUIREMENTS+ " TEXT,"+ SessionsColumns.SESSION_KEYWORDS+ " TEXT,"+ SessionsColumns.SESSION_HASHTAG+ " TEXT,"+ SessionsColumns.SESSION_SLUG+ " TEXT,"+ SessionsColumns.SESSION_URL+ " TEXT,"+ SessionsColumns.SESSION_MODERATOR_URL+ " TEXT,"+ SessionsColumns.SESSION_YOUTUBE_URL+ " TEXT,"+ SessionsColumns.SESSION_PDF_URL+ " TEXT,"+ SessionsColumns.SESSION_FEEDBACK_URL+ " TEXT,"+ SessionsColumns.SESSION_NOTES_URL+ " TEXT,"+ SessionsColumns.SESSION_STARRED+ " INTEGER NOT NULL DEFAULT 0,"+ "UNIQUE ("+ SessionsColumns.SESSION_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SpeakersColumns.SPEAKER_ID+ " TEXT NOT NULL,"+ SpeakersColumns.SPEAKER_NAME+ " TEXT,"+ SpeakersColumns.SPEAKER_IMAGE_URL+ " TEXT,"+ SpeakersColumns.SPEAKER_COMPANY+ " TEXT,"+ SpeakersColumns.SPEAKER_ABSTRACT+ " TEXT,"+ SpeakersColumns.SPEAKER_URL+ " TEXT,"+ "UNIQUE ("+ SpeakersColumns.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsSpeakers.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ " TEXT NOT NULL "+ References.SPEAKER_ID+ ","+ "UNIQUE ("+ SessionsSpeakers.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsTracks.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ " TEXT NOT NULL "+ References.TRACK_ID+ ","+ "UNIQUE ("+ SessionsTracks.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.VENDORS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ VendorsColumns.VENDOR_ID+ " TEXT NOT NULL,"+ Vendors.TRACK_ID+ " TEXT "+ References.TRACK_ID+ ","+ VendorsColumns.VENDOR_NAME+ " TEXT,"+ VendorsColumns.VENDOR_LOCATION+ " TEXT,"+ VendorsColumns.VENDOR_DESC+ " TEXT,"+ VendorsColumns.VENDOR_URL+ " TEXT,"+ VendorsColumns.VENDOR_PRODUCT_DESC+ " TEXT,"+ VendorsColumns.VENDOR_LOGO_URL+ " TEXT,"+ VendorsColumns.VENDOR_STARRED+ " INTEGER,"+ "UNIQUE ("+ VendorsColumns.VENDOR_ID+ ") ON CONFLICT REPLACE)");
  createSessionsSearch(db);
  createVendorsSearch(db);
  db.execSQL("CREATE TABLE " + Tables.SEARCH_SUGGEST + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SearchManager.SUGGEST_COLUMN_TEXT_1+ " TEXT NOT NULL)");
}
 

Example 16

From project DeliciousDroid, under directory /src/com/deliciousdroid/platform/.

Source file: BookmarkManager.java

  15 
vote

public static Bookmark GetById(int id,Context context) throws ContentNotFoundException {
  String[] projection=new String[]{Bookmark.Account,Bookmark.Url,Bookmark.Description,Bookmark.Notes,Bookmark.Time,Bookmark.Tags,Bookmark.Hash,Bookmark.Meta};
  String selection=BaseColumns._ID + "=?";
  String[] selectionargs=new String[]{Integer.toString(id)};
  Uri bookmarks=Bookmark.CONTENT_URI;
  Cursor c=context.getContentResolver().query(bookmarks,projection,selection,selectionargs,null);
  if (c.moveToFirst()) {
    int accountColumn=c.getColumnIndex(Bookmark.Account);
    int urlColumn=c.getColumnIndex(Bookmark.Url);
    int descriptionColumn=c.getColumnIndex(Bookmark.Description);
    int notesColumn=c.getColumnIndex(Bookmark.Notes);
    int tagsColumn=c.getColumnIndex(Bookmark.Tags);
    int hashColumn=c.getColumnIndex(Bookmark.Hash);
    int metaColumn=c.getColumnIndex(Bookmark.Meta);
    int timeColumn=c.getColumnIndex(Bookmark.Time);
    String account=c.getString(accountColumn);
    String url=c.getString(urlColumn);
    String description=c.getString(descriptionColumn);
    String notes=c.getString(notesColumn);
    String tags=c.getString(tagsColumn);
    String hash=c.getString(hashColumn);
    String meta=c.getString(metaColumn);
    long time=c.getLong(timeColumn);
    c.close();
    return new Bookmark(id,account,url,description,notes,tags,hash,meta,time);
  }
 else {
    c.close();
    throw new ContentNotFoundException();
  }
}
 

Example 17

From project devoxx-france-android-in-fine, under directory /src/com/infine/android/devoxx/provider/.

Source file: ScheduleDatabase.java

  15 
vote

@Override public void onCreate(SQLiteDatabase db){
  if (!isTableExists(Tables.BLOCKS,db)) {
    db.execSQL("CREATE TABLE " + Tables.BLOCKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ BlocksColumns.BLOCK_ID+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_TITLE+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_CATEGORY+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_START+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_END+ " INTEGER NOT NULL,"+ "UNIQUE ("+ BlocksColumns.BLOCK_ID+ ") ON CONFLICT REPLACE)");
  }
  if (!isTableExists(Tables.TWEETS,db)) {
    db.execSQL("CREATE TABLE " + Tables.TWEETS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ TweetsColumns.TWEET_ID+ " TEXT NOT NULL,"+ TweetsColumns.USER+ " TEXT,"+ TweetsColumns.USER_NAME+ " TEXT,"+ TweetsColumns.IMAGE_URL+ " TEXT,"+ TweetsColumns.TEXT+ " TEXT,"+ TweetsColumns.CREATION_DATE+ " INTEGER,"+ "UNIQUE ("+ TweetsColumns.TWEET_ID+ ") ON CONFLICT REPLACE)");
  }
  if (!isTableExists(Tables.ROOMS,db)) {
    db.execSQL("CREATE TABLE " + Tables.ROOMS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ RoomsColumns.ROOM_ID+ " TEXT NOT NULL,"+ RoomsColumns.ROOM_NAME+ " TEXT,"+ RoomsColumns.ROOM_FLOOR+ " TEXT,"+ "UNIQUE ("+ RoomsColumns.ROOM_ID+ ") ON CONFLICT REPLACE)");
  }
  if (!isTableExists(Tables.SESSIONS,db)) {
    db.execSQL("CREATE TABLE " + Tables.SESSIONS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SessionsColumns.SESSION_ID+ " TEXT NOT NULL,"+ Sessions.BLOCK_ID+ " TEXT "+ References.BLOCK_ID+ ","+ Sessions.ROOM_ID+ " TEXT "+ References.ROOM_ID+ ","+ SessionsColumns.SESSION_EXPERIENCE+ " TEXT,"+ SessionsColumns.SESSION_TITLE+ " TEXT,"+ SessionsColumns.SESSION_TYPE+ " TEXT,"+ SessionsColumns.SESSION_THEME+ " TEXT,"+ SessionsColumns.SESSION_ROOM+ " TEXT,"+ SessionsColumns.SESSION_SUMMARY+ " TEXT,"+ SessionsColumns.SESSION_SPEAKERS+ " TEXT,"+ SessionsColumns.SESSION_TAGS+ " TEXT,"+ SessionsColumns.SESSION_URL+ " TEXT,"+ SessionsColumns.SESSION_FEEDBACK_URL+ " TEXT,"+ SessionsColumns.SESSION_NOTES_URL+ " TEXT,"+ SessionsColumns.SESSION_SPONSORED+ " INTEGER,"+ SessionsColumns.SESSION_STARRED+ " INTEGER NOT NULL DEFAULT 0,"+ "UNIQUE ("+ SessionsColumns.SESSION_ID+ ") ON CONFLICT REPLACE)");
  }
  if (!isTableExists(Tables.SPEAKERS,db)) {
    db.execSQL("CREATE TABLE " + Tables.SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SpeakersColumns.SPEAKER_ID+ " TEXT NOT NULL,"+ SpeakersColumns.SPEAKER_NAME+ " TEXT,"+ SpeakersColumns.SPEAKER_IMAGE_URL+ " TEXT,"+ SpeakersColumns.SPEAKER_COMPANY+ " TEXT,"+ SpeakersColumns.SPEAKER_ABSTRACT+ " TEXT,"+ SpeakersColumns.SPEAKER_URL+ " TEXT,"+ SpeakersColumns.SPEAKER_SESSIONS+ " TEXT,"+ "UNIQUE ("+ SpeakersColumns.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  }
  createSessionsSearch(db);
}
 

Example 18

From project eoit, under directory /EOIT/src/fr/eoit/db/.

Source file: SearchDatabase.java

  15 
vote

/** 
 * Builds a map for all columns that may be requested, which will be given to the  SQLiteQueryBuilder. This is a good way to define aliases for column names, but must include  all columns, even if the value is the key. This allows the ContentProvider to request columns w/o the need to know real column names and create the alias itself.
 */
private static Map<String,String> buildColumnMap(){
  Map<String,String> map=new HashMap<String,String>();
  map.put(KEY_ITEM_NAME,KEY_ITEM_NAME);
  map.put(KEY_ITEM_INFO,KEY_ITEM_INFO);
  map.put(ITEM_ID,ITEM_ID);
  map.put(BaseColumns._ID,"rowid AS " + BaseColumns._ID);
  map.put(SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID,ITEM_ID + " AS " + SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID);
  map.put(SearchManager.SUGGEST_COLUMN_SHORTCUT_ID,"rowid AS " + SearchManager.SUGGEST_COLUMN_SHORTCUT_ID);
  map.put(SearchManager.SUGGEST_COLUMN_ICON_1,SearchManager.SUGGEST_COLUMN_ICON_1);
  return map;
}
 

Example 19

From project fanfoudroid, under directory /src/com/ch_linghu/fanfoudroid/.

Source file: ProfileActivity.java

  15 
vote

/** 
 * ?????????????
 * @return
 */
private boolean updateUser(){
  ContentValues v=new ContentValues();
  v.put(BaseColumns._ID,profileInfo.getName());
  v.put(UserInfoTable.FIELD_USER_NAME,profileInfo.getName());
  v.put(UserInfoTable.FIELD_USER_SCREEN_NAME,profileInfo.getScreenName());
  v.put(UserInfoTable.FIELD_PROFILE_IMAGE_URL,profileInfo.getProfileImageURL().toString());
  v.put(UserInfoTable.FIELD_LOCALTION,profileInfo.getLocation());
  v.put(UserInfoTable.FIELD_DESCRIPTION,profileInfo.getDescription());
  v.put(UserInfoTable.FIELD_PROTECTED,profileInfo.isProtected());
  v.put(UserInfoTable.FIELD_FOLLOWERS_COUNT,profileInfo.getFollowersCount());
  v.put(UserInfoTable.FIELD_LAST_STATUS,profileInfo.getStatusSource());
  v.put(UserInfoTable.FIELD_FRIENDS_COUNT,profileInfo.getFriendsCount());
  v.put(UserInfoTable.FIELD_FAVORITES_COUNT,profileInfo.getFavouritesCount());
  v.put(UserInfoTable.FIELD_STATUSES_COUNT,profileInfo.getStatusesCount());
  v.put(UserInfoTable.FIELD_FOLLOWING,profileInfo.isFollowing());
  if (profileInfo.getURL() != null) {
    v.put(UserInfoTable.FIELD_URL,profileInfo.getURL().toString());
  }
  return db.updateUser(profileInfo.getId(),v);
}
 

Example 20

From project filemanager, under directory /FileManager/src/org/openintents/filemanager/search/.

Source file: SearchSuggestionsProvider.java

  15 
vote

@Override public Uri insert(Uri uri,ContentValues values){
  long id=mSuggestions.size() + 1;
  values.put(BaseColumns._ID,id);
  mSuggestions.add(values);
  Uri _uri=ContentUris.withAppendedId(CONTENT_URI,id);
  getContext().getContentResolver().notifyChange(_uri,null);
  return _uri;
}
 

Example 21

From project gddsched2, under directory /trunk/android/src/com/google/android/apps/iosched2/provider/.

Source file: ScheduleDatabase.java

  15 
vote

@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("CREATE TABLE " + Tables.BLOCKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ BlocksColumns.BLOCK_ID+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_TITLE+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_START+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_END+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_TYPE+ " TEXT,"+ "UNIQUE ("+ BlocksColumns.BLOCK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ TracksColumns.TRACK_ID+ " TEXT NOT NULL,"+ TracksColumns.TRACK_NAME+ " TEXT,"+ TracksColumns.TRACK_COLOR+ " INTEGER,"+ TracksColumns.TRACK_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ TracksColumns.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.ROOMS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ RoomsColumns.ROOM_ID+ " TEXT NOT NULL,"+ RoomsColumns.ROOM_NAME+ " TEXT,"+ RoomsColumns.ROOM_FLOOR+ " TEXT,"+ "UNIQUE ("+ RoomsColumns.ROOM_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SessionsColumns.SESSION_ID+ " TEXT NOT NULL,"+ Sessions.BLOCK_ID+ " TEXT "+ References.BLOCK_ID+ ","+ Sessions.ROOM_ID+ " TEXT "+ References.ROOM_ID+ ","+ SessionsColumns.SESSION_LEVEL+ " TEXT,"+ SessionsColumns.SESSION_TITLE+ " TEXT,"+ SessionsColumns.SESSION_ABSTRACT+ " TEXT,"+ SessionsColumns.SESSION_REQUIREMENTS+ " TEXT,"+ SessionsColumns.SESSION_KEYWORDS+ " TEXT,"+ SessionsColumns.SESSION_HASHTAG+ " TEXT,"+ SessionsColumns.SESSION_SLUG+ " TEXT,"+ SessionsColumns.SESSION_URL+ " TEXT,"+ SessionsColumns.SESSION_MODERATOR_URL+ " TEXT,"+ SessionsColumns.SESSION_YOUTUBE_URL+ " TEXT,"+ SessionsColumns.SESSION_PDF_URL+ " TEXT,"+ SessionsColumns.SESSION_FEEDBACK_URL+ " TEXT,"+ SessionsColumns.SESSION_NOTES_URL+ " TEXT,"+ SessionsColumns.SESSION_STARRED+ " INTEGER NOT NULL DEFAULT 0,"+ "UNIQUE ("+ SessionsColumns.SESSION_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SpeakersColumns.SPEAKER_ID+ " TEXT NOT NULL,"+ SpeakersColumns.SPEAKER_NAME+ " TEXT,"+ SpeakersColumns.SPEAKER_IMAGE_URL+ " TEXT,"+ SpeakersColumns.SPEAKER_COMPANY+ " TEXT,"+ SpeakersColumns.SPEAKER_ABSTRACT+ " TEXT,"+ SpeakersColumns.SPEAKER_URL+ " TEXT,"+ "UNIQUE ("+ SpeakersColumns.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsSpeakers.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ " TEXT NOT NULL "+ References.SPEAKER_ID+ ","+ "UNIQUE ("+ SessionsSpeakers.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsTracks.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ " TEXT NOT NULL "+ References.TRACK_ID+ ","+ "UNIQUE ("+ SessionsTracks.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.VENDORS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ VendorsColumns.VENDOR_ID+ " TEXT NOT NULL,"+ Vendors.TRACK_ID+ " TEXT "+ References.TRACK_ID+ ","+ VendorsColumns.VENDOR_NAME+ " TEXT,"+ VendorsColumns.VENDOR_LOCATION+ " TEXT,"+ VendorsColumns.VENDOR_DESC+ " TEXT,"+ VendorsColumns.VENDOR_URL+ " TEXT,"+ VendorsColumns.VENDOR_PRODUCT_DESC+ " TEXT,"+ VendorsColumns.VENDOR_LOGO_URL+ " TEXT,"+ VendorsColumns.VENDOR_STARRED+ " INTEGER,"+ "UNIQUE ("+ VendorsColumns.VENDOR_ID+ ") ON CONFLICT REPLACE)");
  createSessionsSearch(db);
  createVendorsSearch(db);
  db.execSQL("CREATE TABLE " + Tables.SEARCH_SUGGEST + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SearchManager.SUGGEST_COLUMN_TEXT_1+ " TEXT NOT NULL)");
}
 

Example 22

From project Gibberbot, under directory /src/info/guardianproject/otr/app/im/service/.

Source file: ChatSessionAdapter.java

  15 
vote

/** 
 * Sends a message to other participant(s) in this session without adding it to the history.
 * @param msg the message to send.
 */
void sendPostponedMessages(){
  String[] projection=new String[]{BaseColumns._ID,Imps.Messages.BODY,Imps.Messages.PACKET_ID,Imps.Messages.DATE,Imps.Messages.TYPE};
  String selection=Imps.Messages.TYPE + "=?";
  Cursor c=mContentResolver.query(mMessageURI,projection,selection,new String[]{Integer.toString(Imps.MessageType.POSTPONED)},null);
  if (c == null) {
    RemoteImService.debug("Query error while querying postponed messages");
    return;
  }
  while (c.moveToNext()) {
    String body=c.getString(1);
    String id=c.getString(2);
    Message msg=new Message(body);
    msg.setFrom(mConnection.getLoginUser().getAddress());
    msg.setID(id);
    updateMessageInDb(id,Imps.MessageType.OUTGOING,System.currentTimeMillis());
    mAdaptee.sendMessageAsync(msg);
  }
  c.close();
}
 

Example 23

From project hsDroid, under directory /src/de/nware/app/hsDroid/ui/.

Source file: Certifications.java

  15 
vote

private File getFileByPos(int position,boolean downloadFile,boolean openFile){
  String selection=BaseColumns._ID + " LIKE ?";
  final Cursor cur=getContentResolver().query(CertificationsCol.CONTENT_URI,null,selection,new String[]{String.valueOf(position)},null);
  startManagingCursor(cur);
  cur.move(position + 1);
  currentURL=cur.getString(cur.getColumnIndexOrThrow(CertificationsCol.LINK));
  currentCertName=cur.getString(cur.getColumnIndexOrThrow(CertificationsCol.TITLE));
  String downloadPath=mPreferences.getString("downloadPathPref",defaultDLPath);
  System.out.println(mPreferences + currentCertName + ".pdf");
  currentFile=new File(downloadPath,currentCertName + ".pdf");
  if (downloadFile) {
    if (currentFile.exists()) {
      showDialog(DIALOG_FILE_EXIST);
    }
 else {
      doDownload(currentURL,currentFile,openFile,false);
    }
  }
  return currentFile;
}
 

Example 24

From project iJetty, under directory /console/webapp/src/main/java/org/mortbay/ijetty/console/.

Source file: MediaRestServlet.java

  15 
vote

@Override public ContentValues cursorToValues(Cursor cursor){
  ContentValues values=new ContentValues();
  String val;
  val=cursor.getString(cursor.getColumnIndex(android.provider.BaseColumns._ID));
  values.put(android.provider.BaseColumns._ID,val);
  int idx=-1;
  idx=cursor.getColumnIndex(MediaStore.MediaColumns.TITLE);
  if (idx > -1)   values.put(MediaStore.MediaColumns.TITLE,cursor.getString(idx));
  idx=cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME);
  if (idx > -1)   values.put(MediaStore.MediaColumns.DISPLAY_NAME,cursor.getString(idx));
  idx=cursor.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE);
  if (idx > -1)   values.put(MediaStore.MediaColumns.MIME_TYPE,cursor.getString(idx));
  idx=cursor.getColumnIndex(MediaStore.MediaColumns.SIZE);
  if (idx > -1)   values.put(MediaStore.MediaColumns.SIZE,cursor.getString(idx));
  idx=cursor.getColumnIndex(MediaStore.Audio.AudioColumns.IS_MUSIC);
  if (idx > -1) {
    int music=cursor.getInt(idx);
    if (music > 0) {
      idx=cursor.getColumnIndex(MediaStore.Audio.AudioColumns.ARTIST);
      if (idx > -1)       values.put(MediaStore.Audio.AudioColumns.ARTIST,cursor.getString(idx));
      idx=cursor.getColumnIndex(MediaStore.Audio.AudioColumns.ALBUM);
      if (idx > -1)       values.put(MediaStore.Audio.AudioColumns.ALBUM,cursor.getString(idx));
    }
  }
  return values;
}
 

Example 25

From project iosched, under directory /android/src/com/google/android/apps/iosched/provider/.

Source file: ScheduleDatabase.java

  15 
vote

@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("CREATE TABLE " + Tables.BLOCKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ BlocksColumns.BLOCK_ID+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_TITLE+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_START+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_END+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_TYPE+ " TEXT,"+ "UNIQUE ("+ BlocksColumns.BLOCK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ TracksColumns.TRACK_ID+ " TEXT NOT NULL,"+ TracksColumns.TRACK_NAME+ " TEXT,"+ TracksColumns.TRACK_COLOR+ " INTEGER,"+ TracksColumns.TRACK_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ TracksColumns.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.ROOMS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ RoomsColumns.ROOM_ID+ " TEXT NOT NULL,"+ RoomsColumns.ROOM_NAME+ " TEXT,"+ RoomsColumns.ROOM_FLOOR+ " TEXT,"+ "UNIQUE ("+ RoomsColumns.ROOM_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SessionsColumns.SESSION_ID+ " TEXT NOT NULL,"+ Sessions.BLOCK_ID+ " TEXT "+ References.BLOCK_ID+ ","+ Sessions.ROOM_ID+ " TEXT "+ References.ROOM_ID+ ","+ SessionsColumns.SESSION_LEVEL+ " TEXT,"+ SessionsColumns.SESSION_TITLE+ " TEXT,"+ SessionsColumns.SESSION_ABSTRACT+ " TEXT,"+ SessionsColumns.SESSION_REQUIREMENTS+ " TEXT,"+ SessionsColumns.SESSION_KEYWORDS+ " TEXT,"+ SessionsColumns.SESSION_HASHTAG+ " TEXT,"+ SessionsColumns.SESSION_SLUG+ " TEXT,"+ SessionsColumns.SESSION_URL+ " TEXT,"+ SessionsColumns.SESSION_MODERATOR_URL+ " TEXT,"+ SessionsColumns.SESSION_YOUTUBE_URL+ " TEXT,"+ SessionsColumns.SESSION_PDF_URL+ " TEXT,"+ SessionsColumns.SESSION_FEEDBACK_URL+ " TEXT,"+ SessionsColumns.SESSION_NOTES_URL+ " TEXT,"+ SessionsColumns.SESSION_STARRED+ " INTEGER NOT NULL DEFAULT 0,"+ "UNIQUE ("+ SessionsColumns.SESSION_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SpeakersColumns.SPEAKER_ID+ " TEXT NOT NULL,"+ SpeakersColumns.SPEAKER_NAME+ " TEXT,"+ SpeakersColumns.SPEAKER_IMAGE_URL+ " TEXT,"+ SpeakersColumns.SPEAKER_COMPANY+ " TEXT,"+ SpeakersColumns.SPEAKER_ABSTRACT+ " TEXT,"+ SpeakersColumns.SPEAKER_URL+ " TEXT,"+ "UNIQUE ("+ SpeakersColumns.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsSpeakers.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ " TEXT NOT NULL "+ References.SPEAKER_ID+ ","+ "UNIQUE ("+ SessionsSpeakers.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsTracks.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ " TEXT NOT NULL "+ References.TRACK_ID+ ","+ "UNIQUE ("+ SessionsTracks.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.VENDORS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ VendorsColumns.VENDOR_ID+ " TEXT NOT NULL,"+ Vendors.TRACK_ID+ " TEXT "+ References.TRACK_ID+ ","+ VendorsColumns.VENDOR_NAME+ " TEXT,"+ VendorsColumns.VENDOR_LOCATION+ " TEXT,"+ VendorsColumns.VENDOR_DESC+ " TEXT,"+ VendorsColumns.VENDOR_URL+ " TEXT,"+ VendorsColumns.VENDOR_PRODUCT_DESC+ " TEXT,"+ VendorsColumns.VENDOR_LOGO_URL+ " TEXT,"+ VendorsColumns.VENDOR_STARRED+ " INTEGER,"+ "UNIQUE ("+ VendorsColumns.VENDOR_ID+ ") ON CONFLICT REPLACE)");
  createSessionsSearch(db);
  createVendorsSearch(db);
  db.execSQL("CREATE TABLE " + Tables.SEARCH_SUGGEST + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SearchManager.SUGGEST_COLUMN_TEXT_1+ " TEXT NOT NULL)");
}
 

Example 26

From project iosched2011, under directory /android/src/com/google/android/apps/iosched/provider/.

Source file: ScheduleDatabase.java

  15 
vote

@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("CREATE TABLE " + Tables.BLOCKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ BlocksColumns.BLOCK_ID+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_TITLE+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_START+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_END+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_TYPE+ " TEXT,"+ "UNIQUE ("+ BlocksColumns.BLOCK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ TracksColumns.TRACK_ID+ " TEXT NOT NULL,"+ TracksColumns.TRACK_NAME+ " TEXT,"+ TracksColumns.TRACK_COLOR+ " INTEGER,"+ TracksColumns.TRACK_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ TracksColumns.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.ROOMS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ RoomsColumns.ROOM_ID+ " TEXT NOT NULL,"+ RoomsColumns.ROOM_NAME+ " TEXT,"+ RoomsColumns.ROOM_FLOOR+ " TEXT,"+ "UNIQUE ("+ RoomsColumns.ROOM_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SessionsColumns.SESSION_ID+ " TEXT NOT NULL,"+ Sessions.BLOCK_ID+ " TEXT "+ References.BLOCK_ID+ ","+ Sessions.ROOM_ID+ " TEXT "+ References.ROOM_ID+ ","+ SessionsColumns.SESSION_LEVEL+ " TEXT,"+ SessionsColumns.SESSION_TITLE+ " TEXT,"+ SessionsColumns.SESSION_ABSTRACT+ " TEXT,"+ SessionsColumns.SESSION_REQUIREMENTS+ " TEXT,"+ SessionsColumns.SESSION_KEYWORDS+ " TEXT,"+ SessionsColumns.SESSION_HASHTAG+ " TEXT,"+ SessionsColumns.SESSION_SLUG+ " TEXT,"+ SessionsColumns.SESSION_URL+ " TEXT,"+ SessionsColumns.SESSION_MODERATOR_URL+ " TEXT,"+ SessionsColumns.SESSION_YOUTUBE_URL+ " TEXT,"+ SessionsColumns.SESSION_PDF_URL+ " TEXT,"+ SessionsColumns.SESSION_FEEDBACK_URL+ " TEXT,"+ SessionsColumns.SESSION_NOTES_URL+ " TEXT,"+ SessionsColumns.SESSION_STARRED+ " INTEGER NOT NULL DEFAULT 0,"+ "UNIQUE ("+ SessionsColumns.SESSION_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SpeakersColumns.SPEAKER_ID+ " TEXT NOT NULL,"+ SpeakersColumns.SPEAKER_NAME+ " TEXT,"+ SpeakersColumns.SPEAKER_IMAGE_URL+ " TEXT,"+ SpeakersColumns.SPEAKER_COMPANY+ " TEXT,"+ SpeakersColumns.SPEAKER_ABSTRACT+ " TEXT,"+ SpeakersColumns.SPEAKER_URL+ " TEXT,"+ "UNIQUE ("+ SpeakersColumns.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsSpeakers.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ " TEXT NOT NULL "+ References.SPEAKER_ID+ ","+ "UNIQUE ("+ SessionsSpeakers.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsTracks.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ " TEXT NOT NULL "+ References.TRACK_ID+ ","+ "UNIQUE ("+ SessionsTracks.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.VENDORS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ VendorsColumns.VENDOR_ID+ " TEXT NOT NULL,"+ Vendors.TRACK_ID+ " TEXT "+ References.TRACK_ID+ ","+ VendorsColumns.VENDOR_NAME+ " TEXT,"+ VendorsColumns.VENDOR_LOCATION+ " TEXT,"+ VendorsColumns.VENDOR_DESC+ " TEXT,"+ VendorsColumns.VENDOR_URL+ " TEXT,"+ VendorsColumns.VENDOR_PRODUCT_DESC+ " TEXT,"+ VendorsColumns.VENDOR_LOGO_URL+ " TEXT,"+ VendorsColumns.VENDOR_STARRED+ " INTEGER,"+ "UNIQUE ("+ VendorsColumns.VENDOR_ID+ ") ON CONFLICT REPLACE)");
  createSessionsSearch(db);
  createVendorsSearch(db);
  db.execSQL("CREATE TABLE " + Tables.SEARCH_SUGGEST + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SearchManager.SUGGEST_COLUMN_TEXT_1+ " TEXT NOT NULL)");
}
 

Example 27

From project iosched_1, under directory /src/com/google/android/apps/iosched/provider/.

Source file: ScheduleDatabase.java

  15 
vote

@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("CREATE TABLE " + Tables.BLOCKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ BlocksColumns.BLOCK_ID+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_TITLE+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_START+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_END+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_TYPE+ " TEXT,"+ "UNIQUE ("+ BlocksColumns.BLOCK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ TracksColumns.TRACK_ID+ " TEXT NOT NULL,"+ TracksColumns.TRACK_NAME+ " TEXT,"+ TracksColumns.TRACK_COLOR+ " INTEGER,"+ TracksColumns.TRACK_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ TracksColumns.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.ROOMS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ RoomsColumns.ROOM_ID+ " TEXT NOT NULL,"+ RoomsColumns.ROOM_NAME+ " TEXT,"+ RoomsColumns.ROOM_FLOOR+ " TEXT,"+ "UNIQUE ("+ RoomsColumns.ROOM_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SessionsColumns.SESSION_ID+ " TEXT NOT NULL,"+ Sessions.BLOCK_ID+ " TEXT "+ References.BLOCK_ID+ ","+ Sessions.ROOM_ID+ " TEXT "+ References.ROOM_ID+ ","+ SessionsColumns.TYPE+ " TEXT,"+ SessionsColumns.TITLE+ " TEXT,"+ SessionsColumns.ABSTRACT+ " TEXT,"+ SessionsColumns.REQUIREMENTS+ " TEXT,"+ SessionsColumns.MODERATOR_URL+ " TEXT,"+ SessionsColumns.WAVE_URL+ " TEXT,"+ SessionsColumns.KEYWORDS+ " TEXT,"+ SessionsColumns.HASHTAG+ " TEXT,"+ SessionsColumns.STARRED+ " INTEGER NOT NULL DEFAULT 0,"+ "UNIQUE ("+ SessionsColumns.SESSION_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SpeakersColumns.SPEAKER_ID+ " TEXT NOT NULL,"+ SpeakersColumns.SPEAKER_NAME+ " TEXT,"+ SpeakersColumns.SPEAKER_COMPANY+ " TEXT,"+ SpeakersColumns.SPEAKER_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ SpeakersColumns.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsSpeakers.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ " TEXT NOT NULL "+ References.SPEAKER_ID+ ","+ "UNIQUE ("+ SessionsSpeakers.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsTracks.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ " TEXT NOT NULL "+ References.TRACK_ID+ ","+ "UNIQUE ("+ SessionsTracks.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.VENDORS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ VendorsColumns.VENDOR_ID+ " TEXT NOT NULL,"+ Vendors.TRACK_ID+ " TEXT "+ References.TRACK_ID+ ","+ VendorsColumns.NAME+ " TEXT,"+ VendorsColumns.LOCATION+ " TEXT,"+ VendorsColumns.DESC+ " TEXT,"+ VendorsColumns.URL+ " TEXT,"+ VendorsColumns.PRODUCT_DESC+ " TEXT,"+ VendorsColumns.LOGO_URL+ " TEXT,"+ VendorsColumns.LOGO+ " BLOB DEFAULT NULL,"+ VendorsColumns.STARRED+ " INTEGER,"+ "UNIQUE ("+ VendorsColumns.VENDOR_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.NOTES + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ Notes.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ NotesColumns.NOTE_TIME+ " INTEGER NOT NULL,"+ NotesColumns.NOTE_CONTENT+ " TEXT)");
  createSessionsSearch(db);
  createVendorsSearch(db);
  db.execSQL("CREATE TABLE " + Tables.SEARCH_SUGGEST + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SearchManager.SUGGEST_COLUMN_TEXT_1+ " TEXT NOT NULL)");
}
 

Example 28

From project iosched_2, under directory /android/src/com/google/android/apps/iosched/provider/.

Source file: ScheduleDatabase.java

  15 
vote

@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("CREATE TABLE " + Tables.BLOCKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ BlocksColumns.BLOCK_ID+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_TITLE+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_START+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_END+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_TYPE+ " TEXT,"+ "UNIQUE ("+ BlocksColumns.BLOCK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ TracksColumns.TRACK_ID+ " TEXT NOT NULL,"+ TracksColumns.TRACK_NAME+ " TEXT,"+ TracksColumns.TRACK_COLOR+ " INTEGER,"+ TracksColumns.TRACK_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ TracksColumns.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.ROOMS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ RoomsColumns.ROOM_ID+ " TEXT NOT NULL,"+ RoomsColumns.ROOM_NAME+ " TEXT,"+ RoomsColumns.ROOM_FLOOR+ " TEXT,"+ "UNIQUE ("+ RoomsColumns.ROOM_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SessionsColumns.SESSION_ID+ " TEXT NOT NULL,"+ Sessions.BLOCK_ID+ " TEXT "+ References.BLOCK_ID+ ","+ Sessions.ROOM_ID+ " TEXT "+ References.ROOM_ID+ ","+ SessionsColumns.SESSION_LEVEL+ " TEXT,"+ SessionsColumns.SESSION_TITLE+ " TEXT,"+ SessionsColumns.SESSION_ABSTRACT+ " TEXT,"+ SessionsColumns.SESSION_REQUIREMENTS+ " TEXT,"+ SessionsColumns.SESSION_KEYWORDS+ " TEXT,"+ SessionsColumns.SESSION_HASHTAG+ " TEXT,"+ SessionsColumns.SESSION_SLUG+ " TEXT,"+ SessionsColumns.SESSION_URL+ " TEXT,"+ SessionsColumns.SESSION_MODERATOR_URL+ " TEXT,"+ SessionsColumns.SESSION_YOUTUBE_URL+ " TEXT,"+ SessionsColumns.SESSION_PDF_URL+ " TEXT,"+ SessionsColumns.SESSION_FEEDBACK_URL+ " TEXT,"+ SessionsColumns.SESSION_NOTES_URL+ " TEXT,"+ SessionsColumns.SESSION_STARRED+ " INTEGER NOT NULL DEFAULT 0,"+ "UNIQUE ("+ SessionsColumns.SESSION_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SpeakersColumns.SPEAKER_ID+ " TEXT NOT NULL,"+ SpeakersColumns.SPEAKER_NAME+ " TEXT,"+ SpeakersColumns.SPEAKER_IMAGE_URL+ " TEXT,"+ SpeakersColumns.SPEAKER_COMPANY+ " TEXT,"+ SpeakersColumns.SPEAKER_ABSTRACT+ " TEXT,"+ SpeakersColumns.SPEAKER_URL+ " TEXT,"+ "UNIQUE ("+ SpeakersColumns.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsSpeakers.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ " TEXT NOT NULL "+ References.SPEAKER_ID+ ","+ "UNIQUE ("+ SessionsSpeakers.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsTracks.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ " TEXT NOT NULL "+ References.TRACK_ID+ ","+ "UNIQUE ("+ SessionsTracks.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.VENDORS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ VendorsColumns.VENDOR_ID+ " TEXT NOT NULL,"+ Vendors.TRACK_ID+ " TEXT "+ References.TRACK_ID+ ","+ VendorsColumns.VENDOR_NAME+ " TEXT,"+ VendorsColumns.VENDOR_LOCATION+ " TEXT,"+ VendorsColumns.VENDOR_DESC+ " TEXT,"+ VendorsColumns.VENDOR_URL+ " TEXT,"+ VendorsColumns.VENDOR_PRODUCT_DESC+ " TEXT,"+ VendorsColumns.VENDOR_LOGO_URL+ " TEXT,"+ VendorsColumns.VENDOR_STARRED+ " INTEGER,"+ "UNIQUE ("+ VendorsColumns.VENDOR_ID+ ") ON CONFLICT REPLACE)");
  createSessionsSearch(db);
  createVendorsSearch(db);
  db.execSQL("CREATE TABLE " + Tables.SEARCH_SUGGEST + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SearchManager.SUGGEST_COLUMN_TEXT_1+ " TEXT NOT NULL)");
}
 

Example 29

From project iosched_3, under directory /android/src/com/google/android/apps/iosched/provider/.

Source file: ScheduleDatabase.java

  15 
vote

@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("CREATE TABLE " + Tables.BLOCKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ BlocksColumns.BLOCK_ID+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_TITLE+ " TEXT NOT NULL,"+ BlocksColumns.BLOCK_START+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_END+ " INTEGER NOT NULL,"+ BlocksColumns.BLOCK_TYPE+ " TEXT,"+ BlocksColumns.BLOCK_META+ " TEXT,"+ "UNIQUE ("+ BlocksColumns.BLOCK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ TracksColumns.TRACK_ID+ " TEXT NOT NULL,"+ TracksColumns.TRACK_NAME+ " TEXT,"+ TracksColumns.TRACK_COLOR+ " INTEGER,"+ TracksColumns.TRACK_ABSTRACT+ " TEXT,"+ "UNIQUE ("+ TracksColumns.TRACK_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.ROOMS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ RoomsColumns.ROOM_ID+ " TEXT NOT NULL,"+ RoomsColumns.ROOM_NAME+ " TEXT,"+ RoomsColumns.ROOM_FLOOR+ " TEXT,"+ "UNIQUE ("+ RoomsColumns.ROOM_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SessionsColumns.SESSION_ID+ " TEXT NOT NULL,"+ Sessions.BLOCK_ID+ " TEXT "+ References.BLOCK_ID+ ","+ Sessions.ROOM_ID+ " TEXT "+ References.ROOM_ID+ ","+ SessionsColumns.SESSION_TYPE+ " TEXT,"+ SessionsColumns.SESSION_LEVEL+ " TEXT,"+ SessionsColumns.SESSION_TITLE+ " TEXT,"+ SessionsColumns.SESSION_ABSTRACT+ " TEXT,"+ SessionsColumns.SESSION_REQUIREMENTS+ " TEXT,"+ SessionsColumns.SESSION_TAGS+ " TEXT,"+ SessionsColumns.SESSION_HASHTAGS+ " TEXT,"+ SessionsColumns.SESSION_URL+ " TEXT,"+ SessionsColumns.SESSION_YOUTUBE_URL+ " TEXT,"+ SessionsColumns.SESSION_PDF_URL+ " TEXT,"+ SessionsColumns.SESSION_NOTES_URL+ " TEXT,"+ SessionsColumns.SESSION_STARRED+ " INTEGER NOT NULL DEFAULT 0,"+ SessionsColumns.SESSION_CAL_EVENT_ID+ " INTEGER,"+ SessionsColumns.SESSION_LIVESTREAM_URL+ " TEXT,"+ "UNIQUE ("+ SessionsColumns.SESSION_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ SpeakersColumns.SPEAKER_ID+ " TEXT NOT NULL,"+ SpeakersColumns.SPEAKER_NAME+ " TEXT,"+ SpeakersColumns.SPEAKER_IMAGE_URL+ " TEXT,"+ SpeakersColumns.SPEAKER_COMPANY+ " TEXT,"+ SpeakersColumns.SPEAKER_ABSTRACT+ " TEXT,"+ SpeakersColumns.SPEAKER_URL+ " TEXT,"+ "UNIQUE ("+ SpeakersColumns.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_SPEAKERS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsSpeakers.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ " TEXT NOT NULL "+ References.SPEAKER_ID+ ","+ "UNIQUE ("+ SessionsSpeakers.SESSION_ID+ ","+ SessionsSpeakers.SPEAKER_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.SESSIONS_TRACKS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SessionsTracks.SESSION_ID+ " TEXT NOT NULL "+ References.SESSION_ID+ ","+ SessionsTracks.TRACK_ID+ " TEXT NOT NULL "+ References.TRACK_ID+ ")");
  db.execSQL("CREATE TABLE " + Tables.VENDORS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ VendorsColumns.VENDOR_ID+ " TEXT NOT NULL,"+ Vendors.TRACK_ID+ " TEXT "+ References.TRACK_ID+ ","+ VendorsColumns.VENDOR_NAME+ " TEXT,"+ VendorsColumns.VENDOR_LOCATION+ " TEXT,"+ VendorsColumns.VENDOR_DESC+ " TEXT,"+ VendorsColumns.VENDOR_URL+ " TEXT,"+ VendorsColumns.VENDOR_PRODUCT_DESC+ " TEXT,"+ VendorsColumns.VENDOR_LOGO_URL+ " TEXT,"+ VendorsColumns.VENDOR_STARRED+ " INTEGER,"+ "UNIQUE ("+ VendorsColumns.VENDOR_ID+ ") ON CONFLICT REPLACE)");
  db.execSQL("CREATE TABLE " + Tables.ANNOUNCEMENTS + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SyncColumns.UPDATED+ " INTEGER NOT NULL,"+ AnnouncementsColumns.ANNOUNCEMENT_ID+ " TEXT,"+ AnnouncementsColumns.ANNOUNCEMENT_TITLE+ " TEXT NOT NULL,"+ AnnouncementsColumns.ANNOUNCEMENT_SUMMARY+ " TEXT,"+ AnnouncementsColumns.ANNOUNCEMENT_TRACKS+ " TEXT,"+ AnnouncementsColumns.ANNOUNCEMENT_URL+ " TEXT,"+ AnnouncementsColumns.ANNOUNCEMENT_DATE+ " INTEGER NOT NULL)");
  createSessionsSearch(db);
  createSessionsDeleteTriggers(db);
  db.execSQL("CREATE TABLE " + Tables.SEARCH_SUGGEST + " ("+ BaseColumns._ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+ SearchManager.SUGGEST_COLUMN_TEXT_1+ " TEXT NOT NULL)");
}
 

Example 30

From project liquidroid, under directory /src/liqui/droid/service/.

Source file: CalendarSyncService.java

  15 
vote

private static long getCalendar(Account account){
  Uri calenderUri=Calendars.CONTENT_URI.buildUpon().appendQueryParameter(Calendars.ACCOUNT_NAME,account.name).appendQueryParameter(Calendars.ACCOUNT_TYPE,account.type).appendQueryParameter("account_name",account.name).appendQueryParameter("account_type",account.type).build();
  Cursor c1=mContentResolver.query(calenderUri,new String[]{BaseColumns._ID},null,null,null);
  if (c1.moveToNext() && !c1.isAfterLast()) {
    Log.d("XXXXXXX","id = " + c1.getLong(0));
    return c1.getLong(0);
  }
 else {
    ArrayList<ContentProviderOperation> operationList=new ArrayList<ContentProviderOperation>();
    ContentProviderOperation.Builder builder=ContentProviderOperation.newInsert(Calendars.CONTENT_URI.buildUpon().appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER,"true").appendQueryParameter(Calendars.ACCOUNT_NAME,account.name).appendQueryParameter(Calendars.ACCOUNT_TYPE,account.type).build());
    builder.withValue(Calendars.ACCOUNT_NAME,account.name);
    builder.withValue(Calendars.ACCOUNT_TYPE,account.type);
    builder.withValue(Calendars.NAME,"LiquiDroid Events");
    builder.withValue(Calendars.CALENDAR_DISPLAY_NAME,"LiquiDroid Events");
    builder.withValue(Calendars.CALENDAR_COLOR,-5159922);
    builder.withValue(Calendars.CALENDAR_ACCESS_LEVEL,Calendars.CAL_ACCESS_READ);
    builder.withValue(Calendars.OWNER_ACCOUNT,account.name);
    builder.withValue(Calendars.SYNC_EVENTS,1);
    operationList.add(builder.build());
    Log.d("XXX",builder.build().toString());
    try {
      mContentResolver.applyBatch(CalendarContract.AUTHORITY,operationList);
    }
 catch (    Exception e) {
      e.printStackTrace();
      return -1;
    }
    return getCalendar(account);
  }
}
 

Example 31

From project Locast-Android, under directory /src/edu/mit/mobile/android/content/.

Source file: ManyToMany.java

  15 
vote

/** 
 * Updates the item in the "to" table whose URI is specified. XXX Does not verify that there's actually a relationship between from and to.
 * @param db
 * @param provider
 * @param uri the URI of the child. Child uri must end in its ID
 * @param values
 * @param where
 * @param whereArgs
 * @return the number of items that have been updated
 */
@Override public int updateItem(SQLiteDatabase db,ContentProvider provider,Uri uri,ContentValues values,String where,String[] whereArgs){
  int count;
  if (mToContentUri != null) {
    count=provider.update(ContentUris.withAppendedId(mToContentUri,ContentUris.parseId(uri)),values,where,whereArgs);
  }
 else {
    count=db.update(mToTable,values,ProviderUtils.addExtraWhere(where,BaseColumns._ID + "=?"),ProviderUtils.addExtraWhereArgs(whereArgs,uri.getLastPathSegment()));
  }
  return count;
}
 

Example 32

From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/content/.

Source file: PickContact.java

  15 
vote

@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (data != null) {
    Uri uri=data.getData();
    if (uri != null) {
      Cursor c=null;
      try {
        c=getContentResolver().query(uri,new String[]{BaseColumns._ID},null,null,null);
        if (c != null && c.moveToFirst()) {
          int id=c.getInt(0);
          if (mToast != null) {
            mToast.cancel();
          }
          String txt=mPendingResult.mMsg + ":\n" + uri+ "\nid: "+ id;
          mToast=Toast.makeText(this,txt,Toast.LENGTH_LONG);
          mToast.show();
        }
      }
  finally {
        if (c != null) {
          c.close();
        }
      }
    }
  }
}
 

Example 33

From project NotePad, under directory /NotePad/src/org/openintents/util/.

Source file: ProviderUtils.java

  15 
vote

/** 
 * Returns the row IDs of all affected rows.
 * @param db
 * @param table
 * @param whereClause
 * @param whereArgs
 * @return
 */
public static long[] getAffectedRows(SQLiteDatabase db,String table,String whereClause,String[] whereArgs){
  if (TextUtils.isEmpty(whereClause)) {
    return null;
  }
  Cursor c=db.query(table,new String[]{BaseColumns._ID},whereClause,whereArgs,null,null,null);
  long[] affectedRows=null;
  if (c != null) {
    affectedRows=new long[c.getCount()];
    for (int i=0; c.moveToNext(); i++) {
      affectedRows[i]=c.getLong(0);
    }
  }
  return affectedRows;
}
 

Example 34

From project ohmagePhone, under directory /src/org/ohmage/db/.

Source file: DbHelper.java

  15 
vote

/** 
 * Adds a response to the feedback database.
 * @return the ID of the inserted record, or -1 if unsuccessful
 */
public long addResponseRow(SQLiteDatabase db,ContentValues values){
  long rowId=-1;
  String response=values.getAsString(Responses.RESPONSE_JSON);
  String campaignUrn=values.getAsString(Responses.CAMPAIGN_URN);
  String surveyId=values.getAsString(Responses.SURVEY_ID);
  boolean madeTransaction=!db.inTransaction();
  try {
    if (madeTransaction)     db.beginTransaction();
    rowId=db.insert(Tables.RESPONSES,null,values);
    if (rowId == -1) {
      if (values.containsKey(Responses.RESPONSE_UUID)) {
        Cursor c=db.query(Tables.RESPONSES,new String[]{BaseColumns._ID},Responses.RESPONSE_UUID + "=?",new String[]{values.getAsString(Responses.RESPONSE_UUID)},null,null,null);
        if (c.moveToFirst()) {
          rowId=c.getLong(0);
          c.close();
          db.update(Tables.RESPONSES,values,Responses.RESPONSE_UUID + "=?",new String[]{values.getAsString(Responses.RESPONSE_UUID)});
        }
      }
      if (rowId != -1 && madeTransaction)       db.setTransactionSuccessful();
    }
 else {
      if (populatePromptsFromResponseJSON(db,rowId,response,campaignUrn,surveyId)) {
        if (madeTransaction)         db.setTransactionSuccessful();
      }
    }
  }
  finally {
    if (madeTransaction)     db.endTransaction();
  }
  return rowId;
}
 

Example 35

From project OpenBike, under directory /src/fr/openbike/android/database/.

Source file: OpenBikeDBAdapter.java

  15 
vote

public boolean insertNetwork(Network network) throws SQLiteException {
  if (network == null)   return false;
  if (getNetwork(network.getId(),new String[]{BaseColumns._ID}) != null) {
    return false;
  }
  ContentValues newValues=new ContentValues();
  newValues.put(BaseColumns._ID,network.getId());
  newValues.put(KEY_NAME,network.getName());
  newValues.put(KEY_CITY,network.getCity());
  newValues.put(KEY_SERVER,network.getServerUrl());
  newValues.put(KEY_LONGITUDE,network.getLongitude());
  newValues.put(KEY_LATITUDE,network.getLatitude());
  newValues.put(KEY_SPECIAL_NAME,network.getSpecialName());
  newValues.put(KEY_VERSION,0);
  mDb.insertOrThrow(NETWORKS_TABLE,null,newValues);
  return true;
}
 

Example 36

From project persistence, under directory /src/main/java/com/codeslap/persistence/suggestions/.

Source file: SuggestionsCursor.java

  15 
vote

SuggestionsCursor(List<SuggestionInfo> suggestionInfos){
  mSuggestionInfos.addAll(suggestionInfos);
  if (suggestionInfos.size() > 0 && suggestionInfos.get(0).getDescription() != null) {
    COLUMNS=new String[]{BaseColumns._ID,SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID,SearchManager.SUGGEST_COLUMN_TEXT_1,SearchManager.SUGGEST_COLUMN_TEXT_2};
  }
 else {
    COLUMNS=new String[]{BaseColumns._ID,SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID,SearchManager.SUGGEST_COLUMN_TEXT_1};
  }
}
 

Example 37

From project PinDroid, under directory /src/com/pindroid/platform/.

Source file: BookmarkManager.java

  15 
vote

public static Bookmark GetById(int id,Context context) throws ContentNotFoundException {
  final String[] projection=new String[]{Bookmark.Account,Bookmark.Url,Bookmark.Description,Bookmark.Notes,Bookmark.Time,Bookmark.Tags,Bookmark.Hash,Bookmark.Meta,Bookmark.ToRead,Bookmark.Shared,Bookmark.Synced,Bookmark.Deleted};
  String selection=BaseColumns._ID + "=?";
  final String[] selectionargs=new String[]{Integer.toString(id)};
  selection+=" AND " + Bookmark.Deleted + "=0";
  Cursor c=context.getContentResolver().query(Bookmark.CONTENT_URI,projection,selection,selectionargs,null);
  if (c.moveToFirst()) {
    final int accountColumn=c.getColumnIndex(Bookmark.Account);
    final int urlColumn=c.getColumnIndex(Bookmark.Url);
    final int descriptionColumn=c.getColumnIndex(Bookmark.Description);
    final int notesColumn=c.getColumnIndex(Bookmark.Notes);
    final int tagsColumn=c.getColumnIndex(Bookmark.Tags);
    final int hashColumn=c.getColumnIndex(Bookmark.Hash);
    final int metaColumn=c.getColumnIndex(Bookmark.Meta);
    final int timeColumn=c.getColumnIndex(Bookmark.Time);
    final int readColumn=c.getColumnIndex(Bookmark.ToRead);
    final int shareColumn=c.getColumnIndex(Bookmark.Shared);
    final int syncedColumn=c.getColumnIndex(Bookmark.Synced);
    final int deletedColumn=c.getColumnIndex(Bookmark.Deleted);
    final boolean read=c.getInt(readColumn) == 0 ? false : true;
    final boolean share=c.getInt(shareColumn) == 0 ? false : true;
    final boolean synced=c.getInt(syncedColumn) == 0 ? false : true;
    final boolean deleted=c.getInt(deletedColumn) == 0 ? false : true;
    Bookmark b=new Bookmark(id,c.getString(accountColumn),c.getString(urlColumn),c.getString(descriptionColumn),c.getString(notesColumn),c.getString(tagsColumn),c.getString(hashColumn),c.getString(metaColumn),c.getLong(timeColumn),read,share,synced,deleted);
    c.close();
    return b;
  }
 else {
    c.close();
    throw new ContentNotFoundException();
  }
}
 

Example 38

From project platform_packages_apps_contacts, under directory /tests/src/com/android/contacts/.

Source file: EntityDeltaListTests.java

  15 
vote

static void assertDiffPattern(ArrayList<ContentProviderOperation> diff,ContentProviderOperation... pattern){
  assertEquals("Unexpected operations",pattern.length,diff.size());
  for (int i=0; i < pattern.length; i++) {
    final ContentProviderOperation expected=pattern[i];
    final ContentProviderOperation found=diff.get(i);
    assertEquals("Unexpected uri",expected.getUri(),found.getUri());
    final String expectedType=getStringForType(expected.getType());
    final String foundType=getStringForType(found.getType());
    assertEquals("Unexpected type",expectedType,foundType);
    if (expected.getType() == TYPE_DELETE)     continue;
    try {
      final ContentValues expectedValues=getValues(expected);
      final ContentValues foundValues=getValues(found);
      expectedValues.remove(BaseColumns._ID);
      foundValues.remove(BaseColumns._ID);
      assertEquals("Unexpected values",expectedValues,foundValues);
    }
 catch (    NoSuchFieldException e) {
      fail(e.toString());
    }
catch (    IllegalAccessException e) {
      fail(e.toString());
    }
  }
}
 

Example 39

From project platform_packages_apps_im, under directory /src/com/android/im/service/.

Source file: ChatSessionAdapter.java

  15 
vote

void sendPostponedMessages(){
  String[] projection=new String[]{BaseColumns._ID,Imps.Messages.BODY,Imps.Messages.DATE,Imps.Messages.TYPE};
  String selection="messages.type=?";
  Cursor c=mContentResolver.query(mMessageURI,projection,selection,new String[]{Integer.toString(Imps.MessageType.POSTPONED)},null);
  if (c == null) {
    Log.e(TAG,"Query error while querying postponed messages");
    return;
  }
  while (c.moveToNext()) {
    String body=c.getString(1);
    mAdaptee.sendMessageAsync(new Message(body));
    c.updateLong(2,System.currentTimeMillis());
    c.updateInt(3,Imps.MessageType.OUTGOING);
  }
  c.commitUpdates();
  c.close();
}
 

Example 40

From project platform_packages_apps_mms, under directory /src/com/android/mms/data/.

Source file: Conversation.java

  15 
vote

public static void dumpSmsTable(Context context){
  LogTag.debug("**** Dump of sms table ****");
  Cursor c=context.getContentResolver().query(Sms.CONTENT_URI,SMS_PROJECTION,null,null,"_id DESC");
  try {
    c.moveToPosition(-1);
    while (c.moveToNext() && c.getPosition() < 20) {
      String body=c.getString(COLUMN_SMS_BODY);
      LogTag.debug("dumpSmsTable " + BaseColumns._ID + ": "+ c.getLong(COLUMN_ID)+ " "+ Sms.THREAD_ID+ " : "+ c.getLong(DATE)+ " "+ Sms.ADDRESS+ " : "+ c.getString(COLUMN_SMS_ADDRESS)+ " "+ Sms.BODY+ " : "+ body.substring(0,Math.min(body.length(),8))+ " "+ Sms.DATE+ " : "+ c.getLong(COLUMN_SMS_DATE)+ " "+ Sms.TYPE+ " : "+ c.getInt(COLUMN_SMS_TYPE));
    }
  }
  finally {
    c.close();
  }
}
 

Example 41

From project platform_packages_apps_music, under directory /src/com/android/music/.

Source file: QueryBrowserActivity.java

  15 
vote

private Cursor getQueryCursor(AsyncQueryHandler async,String filter){
  if (filter == null) {
    filter="";
  }
  String[] ccols=new String[]{BaseColumns._ID,MediaStore.Audio.Media.MIME_TYPE,MediaStore.Audio.Artists.ARTIST,MediaStore.Audio.Albums.ALBUM,MediaStore.Audio.Media.TITLE,"data1","data2"};
  Uri search=Uri.parse("content://media/external/audio/search/fancy/" + Uri.encode(filter));
  Cursor ret=null;
  if (async != null) {
    async.startQuery(0,null,search,ccols,null,null,null);
  }
 else {
    ret=MusicUtils.query(this,search,ccols,null,null,null);
  }
  return ret;
}
 

Example 42

From project platform_packages_providers_calendarprovider, under directory /src/com/android/providers/calendar/.

Source file: CalendarProvider2.java

  15 
vote

private Cursor query(final SQLiteDatabase db,SQLiteQueryBuilder qb,String[] projection,String selection,String[] selectionArgs,String sortOrder,String groupBy,String limit){
  if (projection != null && projection.length == 1 && BaseColumns._COUNT.equals(projection[0])) {
    qb.setProjectionMap(sCountProjectionMap);
  }
  if (Log.isLoggable(TAG,Log.VERBOSE)) {
    Log.v(TAG,"query sql - projection: " + Arrays.toString(projection) + " selection: "+ selection+ " selectionArgs: "+ Arrays.toString(selectionArgs)+ " sortOrder: "+ sortOrder+ " groupBy: "+ groupBy+ " limit: "+ limit);
  }
  final Cursor c=qb.query(db,projection,selection,selectionArgs,groupBy,null,sortOrder,limit);
  if (c != null) {
    c.setNotificationUri(mContentResolver,CalendarContract.Events.CONTENT_URI);
  }
  return c;
}
 

Example 43

From project platform_packages_providers_contactsprovider, under directory /src/com/android/providers/contacts/.

Source file: ContactsProvider2.java

  15 
vote

private Cursor query(final SQLiteDatabase db,SQLiteQueryBuilder qb,String[] projection,String selection,String[] selectionArgs,String sortOrder,String groupBy,String having,String limit,CancellationSignal cancellationSignal){
  if (projection != null && projection.length == 1 && BaseColumns._COUNT.equals(projection[0])) {
    qb.setProjectionMap(sCountProjectionMap);
  }
  final Cursor c=qb.query(db,projection,selection,selectionArgs,groupBy,having,sortOrder,limit,cancellationSignal);
  if (c != null) {
    c.setNotificationUri(getContext().getContentResolver(),ContactsContract.AUTHORITY_URI);
  }
  return c;
}
 

Example 44

From project rapidandroid, under directory /rapidandroid/org.rapidandroid/src/org/rapidandroid/content/.

Source file: RapidSmsContentProvider.java

  15 
vote

private Uri insertFieldType(Uri uri,ContentValues values){
  if (values.containsKey(BaseColumns._ID) == false || values.containsKey(RapidSmsDBConstants.FieldType.NAME) == false || values.containsKey(RapidSmsDBConstants.FieldType.REGEX) == false || values.containsKey(RapidSmsDBConstants.FieldType.DATATYPE) == false) {
    throw new SQLException("Insufficient arguments for fieldtype insert " + uri);
  }
  return doInsert(uri,values,RapidSmsDBConstants.FieldType.TABLE,RapidSmsDBConstants.FieldType.NAME);
}
 

Example 45

From project reader, under directory /src/com/quietlycoding/android/reader/activity/.

Source file: ChannelList.java

  15 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  View v;
  final Cursor cursor=mCursor;
  if (!cursor.moveToPosition(position)) {
    throw new IllegalStateException("could not move to cursor position: " + position);
  }
  if (convertView == null) {
    v=newView(mContext,cursor,parent);
  }
 else {
    v=convertView;
    final ChannelListItem item=(ChannelListItem)v;
    item.mChannelId=cursor.getLong(cursor.getColumnIndex(BaseColumns._ID));
    item.mSelected=mChecked.contains(Long.valueOf(item.mChannelId));
  }
  bindView(v,mContext,cursor);
  return v;
}
 

Example 46

From project shoppinglist, under directory /ShoppingList/src/org/openintents/intents/.

Source file: ProviderUtils.java

  15 
vote

/** 
 * Returns the row IDs of all affected rows.
 * @param db
 * @param table
 * @param whereClause
 * @param whereArgs
 * @return
 */
public static long[] getAffectedRows(SQLiteDatabase db,String table,String whereClause,String[] whereArgs){
  if (TextUtils.isEmpty(whereClause)) {
    return null;
  }
  Cursor c=db.query(table,new String[]{BaseColumns._ID},whereClause,whereArgs,null,null,null);
  long[] affectedRows=null;
  if (c != null) {
    affectedRows=new long[c.getCount()];
    for (int i=0; c.moveToNext(); i++) {
      affectedRows[i]=c.getLong(0);
    }
  }
  c.close();
  return affectedRows;
}
 

Example 47

From project StegDroid, under directory /src/urbanstew/RehearsalAssistant/.

Source file: RehearsalData.java

  15 
vote

public int update(Uri uri,ContentValues values,String selection,String[] selectionArgs){
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  int count;
  if (uri.getPathSegments().size() > 1)   selection=BaseColumns._ID + "=" + uri.getPathSegments().get(1)+ (!TextUtils.isEmpty(selection) ? " AND (" + selection + ')' : "");
switch (sUriMatcher.match(uri)) {
case APPDATA:
    count=db.update(AppData.TABLE_NAME,values,selection,selectionArgs);
  break;
case PROJECT_ID:
count=db.update(Projects.TABLE_NAME,values,selection,selectionArgs);
break;
case SESSION_ID:
count=db.update(Sessions.TABLE_NAME,values,selection,selectionArgs);
break;
case ANNOTATION_ID:
count=db.update(Annotations.TABLE_NAME,values,selection,selectionArgs);
break;
default :
throw new IllegalArgumentException("Unknown URI " + uri);
}
getContext().getContentResolver().notifyChange(uri,null);
return count;
}
 

Example 48

From project SVQCOM, under directory /Core/src/com/ushahidi/android/app/data/.

Source file: Database.java

  15 
vote

/** 
 * Performs a database query.
 * @param selection The selection clause
 * @param selectionArgs Selection arguments for "?" components in the selection
 * @param columns The columns to return
 * @return A Cursor over all rows matching the query
 */
private Cursor query(String selection,String[] selectionArgs,String[] columns){
  HashMap<String,String> mColumnMap=new HashMap<String,String>();
  mColumnMap.put(DEPLOYMENT_ID,DEPLOYMENT_ID);
  mColumnMap.put(DEPLOYMENT_CAT_ID,DEPLOYMENT_CAT_ID);
  mColumnMap.put(DEPLOYMENT_DESC,DEPLOYMENT_DESC);
  mColumnMap.put(DEPLOYMENT_DATE,DEPLOYMENT_DATE);
  mColumnMap.put(DEPLOYMENT_NAME,DEPLOYMENT_NAME);
  mColumnMap.put(DEPLOYMENT_URL,DEPLOYMENT_URL);
  mColumnMap.put(DEPLOYMENT_LATITUDE,DEPLOYMENT_LATITUDE);
  mColumnMap.put(DEPLOYMENT_LONGITUDE,DEPLOYMENT_LONGITUDE);
  mColumnMap.put(BaseColumns._ID,"rowid AS " + BaseColumns._ID);
  mColumnMap.put(SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID,"rowid AS " + SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID);
  mColumnMap.put(SearchManager.SUGGEST_COLUMN_SHORTCUT_ID,"rowid AS " + SearchManager.SUGGEST_COLUMN_SHORTCUT_ID);
  SQLiteQueryBuilder builder=new SQLiteQueryBuilder();
  builder.setTables(DEPLOYMENT_TABLE);
  builder.setProjectionMap(mColumnMap);
  String orderBy=DEPLOYMENT_DATE + " DESC";
  Cursor cursor=builder.query(mDbHelper.getReadableDatabase(),columns,selection,selectionArgs,null,null,orderBy);
  if (cursor == null) {
    return null;
  }
 else   if (!cursor.moveToFirst()) {
    cursor.close();
    return null;
  }
  return cursor;
}
 

Example 49

From project ub0rlib, under directory /src/de/ub0r/android/lib/apis/.

Source file: ContactsWrapper5.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public Uri getLookupUri(final ContentResolver cr,final String id){
  Log.d(TAG,"getLookupUri(cr, " + id + ")");
  if (TextUtils.isEmpty(id)) {
    return null;
  }
  Uri ret=null;
  final Cursor c=cr.query(Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI,id),new String[]{Contacts.LOOKUP_KEY,BaseColumns._ID},null,null,BaseColumns._ID + " ASC");
  if (c != null) {
    if (c.moveToFirst()) {
      ret=Contacts.getLookupUri(c.getLong(1),id);
    }
    c.close();
  }
  if (ret == null) {
    ret=Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI,id);
  }
  Log.d(TAG,"found uri: " + ret);
  return ret;
}
 

Example 50

From project XTrade, under directory /src/com/xtrade/android/fragment/.

Source file: ContactEditFragment.java

  15 
vote

@Override public View onCreateView(LayoutInflater layoutInflater,ViewGroup container,Bundle savedInstanceState){
  super.onCreateView(layoutInflater,container,savedInstanceState);
  View view=layoutInflater.inflate(R.layout.contact_edit_fragment,container,false);
  cursor=getActivity().getContentResolver().query(DatabaseContract.ContactTypeEntity.CONTENT_URI,new String[]{BaseColumns._ID,ContactTypeColumns.CONTACT_TYPE_ID,ContactTypeColumns.NAME},null,null,null);
  adapter=new SimpleCursorAdapter(getActivity(),android.R.layout.simple_spinner_item,cursor,new String[]{ContactTypeColumns.NAME},new int[]{android.R.id.text1},0);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spnContactType=(Spinner)view.findViewById(R.id.spnContactType);
  spnContactType.setAdapter(adapter);
  ibtContactPhoto=(ImageButton)view.findViewById(R.id.ibtContactPhoto);
  ibtContactPhoto.setClickable(true);
  ibtContactPhoto.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      FragmentTransaction ft=getFragmentManager().beginTransaction();
      Fragment f=getFragmentManager().findFragmentByTag("picture_dialog");
      if (f != null)       ft.remove(f);
      ft.addToBackStack(null);
      DialogFragment dialogFragment=PictureDialog.newInstance(ContactEditFragment.this);
      dialogFragment.show(ft,"picture_dialog");
    }
  }
);
  etxFirstContactName=(EditText)view.findViewById(R.id.etxFirstContactName);
  etxLastContactName=(EditText)view.findViewById(R.id.etxLastContactName);
  etxContactEmail=(EditText)view.findViewById(R.id.etxContactEmail);
  etxContactPhone=(EditText)view.findViewById(R.id.etxContactPhone);
  intent=getActivity().getIntent();
  int extra=intent.getIntExtra("ACTION_TYPE",-1);
  if (Settings.DEBUG && extra == CONTACT_CREATE_REQUEST_CODE) {
    etxFirstContactName.setText("Jos\u00E9 Luis Ayerdis Espinoza");
    etxContactEmail.setText("[email protected]");
    etxContactPhone.setText("86727076");
  }
  if (extra == CONTACT_UPDATE_REQUEST_CODE)   contactId=intent.getLongExtra(ContactColumns.CONTACT_ID,-1);
  setHasOptionsMenu(true);
  return view;
}
 

Example 51

From project yammp, under directory /src/org/yammp/fragment/.

Source file: QueryFragment.java

  15 
vote

@Override public Loader<Cursor> onCreateLoader(int id,Bundle args){
  String filter="";
  if (args != null) {
    filter=args.getString(INTENT_KEY_FILTER) != null ? args.getString(INTENT_KEY_FILTER) : "";
  }
  StringBuilder where=new StringBuilder();
  where.append(Audio.Media.IS_MUSIC + "=1");
  where.append(" AND " + Audio.Media.TITLE + " != ''");
  String[] cols=new String[]{BaseColumns._ID,Audio.Media.MIME_TYPE,Audio.Artists.ARTIST,Audio.Albums.ALBUM,Audio.Media.TITLE,"data1","data2"};
  Uri uri=Uri.parse("content://media/external/audio/search/fancy/" + Uri.encode(filter));
  return new CursorLoader(getActivity(),uri,cols,where.toString(),null,null);
}
 

Example 52

From project zirco-browser, under directory /src/org/zirco/model/adapters/.

Source file: HistoryExpandableListAdapter.java

  15 
vote

/** 
 * Constructor.
 * @param context The current context.
 * @param cursor The data cursor.
 * @param dateIndex The date index ?
 */
public HistoryExpandableListAdapter(Context context,OnCheckedChangeListener bookmarksChangeListener,Cursor cursor,int dateIndex,int faviconSize){
  mContext=context;
  mBookmarkStarChangeListener=bookmarksChangeListener;
  mCursor=cursor;
  mDateIndex=dateIndex;
  mFaviconSize=faviconSize;
  mDateSorter=new DateSorter(mContext);
  mIdIndex=cursor.getColumnIndexOrThrow(BaseColumns._ID);
  mInflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  buildMap();
}