Java Code Examples for android.widget.SimpleCursorAdapter

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 android-joedayz, under directory /Proyectos/TareasSQLite/src/com/androideity/tareasqlite/.

Source file: TareasSQLiteActivity.java

  22 
vote

private void fillData(){
  cursor=dbHelper.fetchAllTodos();
  startManagingCursor(cursor);
  String[] from=new String[]{DBAdapter.KEY_SUMMARY};
  int[] to=new int[]{R.id.label};
  SimpleCursorAdapter notes=new SimpleCursorAdapter(this,R.layout.row,cursor,from,to);
  setListAdapter(notes);
}
 

Example 2

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/list/activity/task/.

Source file: TabbedDueActionsActivity.java

  22 
vote

private void updateCursor(){
  SimpleCursorAdapter adapter=(SimpleCursorAdapter)getListAdapter();
  Cursor oldCursor=adapter.getCursor();
  if (oldCursor != null) {
    stopManagingCursor(oldCursor);
  }
  getTaskListConfig().setTaskQuery(createTaskQuery());
  Cursor cursor=getListConfig().createQuery(this);
  adapter.changeCursor(cursor);
  setTitle(getListConfig().createTitle(this));
}
 

Example 3

From project Android_1, under directory /SharedNotepad/src/com/example/android/notepad/.

Source file: NotesList.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
  Intent intent=getIntent();
  if (intent.getData() == null) {
    intent.setData(Notes.CONTENT_URI);
  }
  getListView().setOnCreateContextMenuListener(this);
  Cursor cursor=managedQuery(getIntent().getData(),PROJECTION,null,null,Notes.DEFAULT_SORT_ORDER);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,R.layout.noteslist_item,cursor,new String[]{Notes.TITLE},new int[]{android.R.id.text1});
  setListAdapter(adapter);
}
 

Example 4

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

Source file: BookEditAnthology.java

  22 
vote

/** 
 * Populate the bookEditAnthology view
 */
public void fillAnthology(){
  int layout=R.layout.row_anthology;
  Cursor BooksCursor=mDbHelper.fetchAnthologyTitlesByBook(mRowId);
  maxPosition=BooksCursor.getCount();
  currentPosition=maxPosition;
  startManagingCursor(BooksCursor);
  String[] from=null;
  int[] to=null;
  from=new String[]{CatalogueDBAdapter.KEY_ROWID,CatalogueDBAdapter.KEY_POSITION,CatalogueDBAdapter.KEY_AUTHOR_NAME,CatalogueDBAdapter.KEY_TITLE};
  to=new int[]{R.id.row_row_id,R.id.row_position,R.id.row_author,R.id.row_title};
  SimpleCursorAdapter books=new AnthologyTitleListAdapter(this,layout,BooksCursor,from,to);
  setListAdapter(books);
  registerForContextMenu(getListView());
}
 

Example 5

From project cw-advandroid, under directory /SMS/Sender/src/com/commonsware/android/sms/sender/.

Source file: NewContactsAdapterBridge.java

  22 
vote

SpinnerAdapter buildPhonesAdapter(Activity a){
  String[] PROJECTION=new String[]{Contacts._ID,Contacts.DISPLAY_NAME,Phone.NUMBER};
  String[] ARGS={String.valueOf(Phone.TYPE_MOBILE)};
  Cursor c=a.managedQuery(Phone.CONTENT_URI,PROJECTION,Phone.TYPE + "=?",ARGS,Contacts.DISPLAY_NAME);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(a,android.R.layout.simple_spinner_item,c,new String[]{Contacts.DISPLAY_NAME},new int[]{android.R.id.text1});
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  return (adapter);
}
 

Example 6

From project cw-omnibus, under directory /Database/Constants/src/com/commonsware/android/constants/.

Source file: ConstantsFragment.java

  22 
vote

@SuppressWarnings("deprecation") @Override public void onPostExecute(Void arg0){
  SimpleCursorAdapter adapter;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    adapter=new SimpleCursorAdapter(getActivity(),R.layout.row,constantsCursor,new String[]{DatabaseHelper.TITLE,DatabaseHelper.VALUE},new int[]{R.id.title,R.id.value},0);
  }
 else {
    adapter=new SimpleCursorAdapter(getActivity(),R.layout.row,constantsCursor,new String[]{DatabaseHelper.TITLE,DatabaseHelper.VALUE},new int[]{R.id.title,R.id.value});
  }
  setListAdapter(adapter);
}
 

Example 7

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

Source file: BrowseBookmarks.java

  22 
vote

private void loadBookmarkList(){
  Cursor c=BookmarkManager.GetBookmarks(username,tagname,sortfield,this);
  startManagingCursor(c);
  SimpleCursorAdapter a=new SimpleCursorAdapter(mContext,R.layout.bookmark_view,c,new String[]{Bookmark.Description,Bookmark.Tags},new int[]{R.id.bookmark_description,R.id.bookmark_tags});
  setListAdapter(a);
}
 

Example 8

From project dmix, under directory /MPDroid/src/com/namelessdev/mpdroid/.

Source file: ServerListActivity.java

  22 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.server_list);
  getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  Cursor cursor=managedQuery(ServerList.ServerColumns.CONTENT_URI,PROJECTION,null,null,ServerList.ServerColumns.DEFAULT_SORT_ORDER);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_list_item_single_choice,cursor,new String[]{ServerList.ServerColumns.NAME},new int[]{android.R.id.text1});
  getListView().setAdapter(adapter);
}
 

Example 9

From project FlipDroid, under directory /app/src/com/goal98/flipdroid2/activity/.

Source file: AccountListActivity.java

  22 
vote

@Override protected void onStart(){
  super.onStart();
  accountCursor=accountDB.findAll();
  startManagingCursor(accountCursor);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,R.layout.account_item,accountCursor,new String[]{Account.KEY_USERNAME,Account.KEY_ACCOUNT_TYPE},new int[]{R.id.accoount_title,R.id.accoount_type});
  setListAdapter(adapter);
}
 

Example 10

From project gast-lib, under directory /app/src/root/gast/playground/speech/food/.

Source file: FoodBrowser.java

  22 
vote

private void setData(){
  cursor=FtsIndexedFoodDatabase.getInstance(this).getAllFood();
  startManagingCursor(cursor);
  String[] columns=new String[]{FtsIndexedFoodDatabase.COLUMN_FOOD,FtsIndexedFoodDatabase.COLUMN_CALORIE};
  int[] to=new int[]{R.id.foodname_entry,R.id.foodcalorie_entry};
  SimpleCursorAdapter mAdapter=new SimpleCursorAdapter(this,R.layout.foodbrowselist_entry,cursor,columns,to);
  setListAdapter(mAdapter);
}
 

Example 11

From project gmarks-android, under directory /src/main/java/org/thomnichols/android/gmarks/.

Source file: ChooseLabelsActivity.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setTitle("Choose Labels");
  setContentView(R.layout.labels_chooser_view);
  final Intent intent=getIntent();
  if (intent.getData() == null)   intent.setData(Label.CONTENT_URI);
  Log.d(TAG,"Intent URI: " + intent.getData());
  Cursor cursor=managedQuery(intent.getData(),PROJECTION,null,null,null);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_list_item_multiple_choice,cursor,new String[]{Label.Columns.TITLE},new int[]{android.R.id.text1});
  setListAdapter(adapter);
}
 

Example 12

From project GSM-Signal-Tracking-, under directory /gpstracker/src/nl/sogeti/android/gpstracker/viewer/.

Source file: TrackList.java

  22 
vote

private void displayCursor(Cursor tracksCursor){
  String[] fromColumns=new String[]{Tracks.NAME,Tracks.CREATION_TIME};
  int[] toItems=new int[]{R.id.listitem_name,R.id.listitem_from};
  SimpleCursorAdapter trackAdapter=new SimpleCursorAdapter(this,R.layout.trackitem,tracksCursor,fromColumns,toItems);
  setListAdapter(trackAdapter);
}
 

Example 13

From project K6nele, under directory /app/src/ee/ioc/phon/android/speak/.

Source file: GrammarListActivity.java

  22 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  String[] columns=new String[]{Grammar.Columns._ID,Grammar.Columns.NAME,Grammar.Columns.LANG,Grammar.Columns.DESC,Grammar.Columns.URL};
  int[] to=new int[]{R.id.itemGrammarId,R.id.itemGrammarName,R.id.itemGrammarLang,R.id.itemGrammarDesc,R.id.itemGrammarUrl};
  Cursor managedCursor=managedQuery(CONTENT_URI,columns,null,null,Grammar.Columns.NAME + " ASC");
  SimpleCursorAdapter mAdapter=new SimpleCursorAdapter(this,R.layout.list_item_grammar,managedCursor,columns,to);
  ListView lv=getListView();
  setEmptyView(getString(R.string.emptylistGrammars));
  lv.setAdapter(mAdapter);
  registerForContextMenu(lv);
  setClickToFinish(CONTENT_URI,Grammar.Columns._ID);
}
 

Example 14

From project keepassdroid, under directory /src/com/keepassdroid/fileselect/.

Source file: FileSelectActivity.java

  22 
vote

private void fillData(){
  EditText filename=(EditText)findViewById(R.id.file_filename);
  filename.setText(Environment.getExternalStorageDirectory() + getString(R.string.default_file_path));
  Cursor filesCursor=mDbHelper.fetchAllFiles();
  startManagingCursor(filesCursor);
  String[] from=new String[]{FileDbHelper.KEY_FILE_FILENAME};
  int[] to=new int[]{R.id.file_filename};
  SimpleCursorAdapter notes=new SimpleCursorAdapter(this,R.layout.file_row,filesCursor,from,to);
  setListAdapter(notes);
}
 

Example 15

From project MyExpenses, under directory /src/org/totschnig/myexpenses/.

Source file: ManageParties.java

  22 
vote

public void fillData(){
  if (mPartiesCursor == null) {
    mPartiesCursor=mDbHelper.fetchPayeeAll();
    startManagingCursor(mPartiesCursor);
  }
 else {
    mPartiesCursor.requery();
  }
  String[] from=new String[]{"name"};
  int[] to=new int[]{android.R.id.text1};
  SimpleCursorAdapter parties=new SimpleCursorAdapter(this,android.R.layout.simple_list_item_multiple_choice,mPartiesCursor,from,to);
  setListAdapter(parties);
}
 

Example 16

From project NotePad, under directory /src/com/nononsenseapps/notepad/.

Source file: NotesListFragment.java

  22 
vote

private void addSectionToAdapter(long sectionId,String sectionname,Cursor data,Comparator<String> comp){
  SimpleCursorAdapter adapter=mSectionAdapter.sections.get(sectionname);
  if (adapter == null) {
    adapter=getThemedAdapter(null);
    if (sectionId > -1)     mSectionAdapter.addSection(sectionId,sectionname,adapter,comp);
 else     mSectionAdapter.addSection(sectionname,adapter,comp);
  }
  adapter.swapCursor(data);
}
 

Example 17

From project nuxeo-android, under directory /nuxeo-automation-sample/src/org/nuxeo/android/automationsample/.

Source file: ContentProviderSampleActivity.java

  22 
vote

@Override protected void onNuxeoDataRetrieved(Object data){
  super.onNuxeoDataRetrieved(data);
  final String[] columns=new String[]{"_ID","dc:title","status","iconUri"};
  final int[] to=new int[]{R.id.id_entry,R.id.title_entry,R.id.status_entry,R.id.iconView};
  SimpleCursorAdapter mAdapter=new SimpleCursorAdapter(this,R.layout.list_item,cursor,columns,to);
  listView.setAdapter(mAdapter);
}
 

Example 18

From project saldo, under directory /src/com/adrup/saldo/.

Source file: BankListActivity.java

  22 
vote

private void fillData(){
  Cursor bankLoginsCursor=mDbAdapter.fetchAllBankLoginsCursor();
  startManagingCursor(bankLoginsCursor);
  String[] from=new String[]{BankLogin.KEY_NAME};
  int[] to=new int[]{R.id.layout_bank_logins_list_name};
  SimpleCursorAdapter bankLogins=new SimpleCursorAdapter(this,R.layout.bank_logins_list_item,bankLoginsCursor,from,to);
  setListAdapter(bankLogins);
}
 

Example 19

From project sonet, under directory /core/src/com/piusvelte/sonet/core/.

Source file: ManageAccounts.java

  22 
vote

private void listAccounts(){
  Cursor c=this.managedQuery(Accounts_styles.getContentUri(this),new String[]{Accounts._ID,"(case when " + Accounts.SERVICE + "="+ Sonet.TWITTER+ " then 'Twitter: ' when "+ Accounts.SERVICE+ "="+ Sonet.FACEBOOK+ " then 'Facebook: ' when "+ Accounts.SERVICE+ "="+ Sonet.MYSPACE+ " then 'MySpace: ' when "+ Accounts.SERVICE+ "="+ Sonet.LINKEDIN+ " then 'LinkedIn: ' when "+ Accounts.SERVICE+ "="+ Sonet.FOURSQUARE+ " then 'Foursquare: ' when "+ Accounts.SERVICE+ "="+ Sonet.CHATTER+ " then 'Chatter: ' when "+ Accounts.SERVICE+ "="+ Sonet.RSS+ " then 'RSS: ' when "+ Accounts.SERVICE+ "="+ Sonet.IDENTICA+ " then 'Identi.ca: ' when "+ Accounts.SERVICE+ "="+ Sonet.GOOGLEPLUS+ " then 'Google+: ' when "+ Accounts.SERVICE+ "="+ Sonet.PINTEREST+ " then 'Pinterest: ' else '' end) as "+ Statuses_styles.FRIEND,"(case when " + Accounts.SERVICE + "="+ Sonet.TWITTER+ " then 'Twitter: ' when "+ Accounts.SERVICE+ "="+ Sonet.FACEBOOK+ " then 'Facebook: ' when "+ Accounts.SERVICE+ "="+ Sonet.MYSPACE+ " then 'MySpace: ' when "+ Accounts.SERVICE+ "="+ Sonet.LINKEDIN+ " then 'LinkedIn: ' when "+ Accounts.SERVICE+ "="+ Sonet.FOURSQUARE+ " then 'Foursquare: ' when "+ Accounts.SERVICE+ "="+ Sonet.CHATTER+ " then 'Chatter: ' when "+ Accounts.SERVICE+ "="+ Sonet.RSS+ " then 'RSS: ' when "+ Accounts.SERVICE+ "="+ Sonet.IDENTICA+ " then 'Identi.ca: ' when "+ Accounts.SERVICE+ "="+ Sonet.GOOGLEPLUS+ " then 'Google+: ' when "+ Accounts.SERVICE+ "="+ Sonet.PINTEREST+ " then 'Pinterest: ' else '' end) as "+ Statuses_styles.FRIEND+ "2","(case when (select " + Widgets.DISPLAY_PROFILE + " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ ") is not null then (select "+ Widgets.DISPLAY_PROFILE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1)"+ "when (select "+ Widgets.DISPLAY_PROFILE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.DISPLAY_PROFILE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "when (select "+ Widgets.DISPLAY_PROFILE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.DISPLAY_PROFILE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "else 1 end) as "+ Statuses_styles.PROFILE,"(case when (select " + Widget_accounts.WIDGET + " from "+ TABLE_WIDGET_ACCOUNTS+ " where "+ Widget_accounts.WIDGET+ "="+ mAppWidgetId+ " and "+ Widget_accounts.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1) is null then 'this account is disabled for this widget, select to enable' else 'account is enabled for this widget, select to change settings' end) as "+ Statuses_styles.MESSAGE,"(case when (select " + Widget_accounts.WIDGET + " from "+ TABLE_WIDGET_ACCOUNTS+ " where "+ Widget_accounts.WIDGET+ "="+ mAppWidgetId+ " and "+ Widget_accounts.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1) is null then 'this account is disabled for this widget, select to enable' else 'account is enabled for this widget, select to change settings' end) as "+ Statuses_styles.MESSAGE+ "2",Accounts.USERNAME + " as " + Statuses_styles.CREATEDTEXT,"(case when (select " + Widgets.MESSAGES_COLOR + " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ ") is not null then (select "+ Widgets.MESSAGES_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1)"+ "when (select "+ Widgets.MESSAGES_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.MESSAGES_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "when (select "+ Widgets.MESSAGES_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.MESSAGES_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "else "+ Sonet.default_message_color+ " end) as "+ Statuses_styles.MESSAGES_COLOR,"(case when (select " + Widgets.FRIEND_COLOR + " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ ") is not null then (select "+ Widgets.FRIEND_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1)"+ "when (select "+ Widgets.FRIEND_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.FRIEND_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "when (select "+ Widgets.FRIEND_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.FRIEND_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "else "+ Sonet.default_friend_color+ " end) as "+ Statuses_styles.FRIEND_COLOR,"(case when (select " + Widgets.CREATED_COLOR + " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ ") is not null then (select "+ Widgets.CREATED_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1)"+ "when (select "+ Widgets.CREATED_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.CREATED_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "when (select "+ Widgets.CREATED_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.CREATED_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "else "+ Sonet.default_created_color+ " end) as "+ Statuses_styles.CREATED_COLOR,"(case when (select " + Widgets.MESSAGES_TEXTSIZE + " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ ") is not null then (select "+ Widgets.MESSAGES_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1)"+ "when (select "+ Widgets.MESSAGES_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.MESSAGES_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "when (select "+ Widgets.MESSAGES_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.MESSAGES_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "else "+ Sonet.default_messages_textsize+ " end) as "+ Statuses_styles.MESSAGES_TEXTSIZE,"(case when (select " + Widgets.FRIEND_TEXTSIZE + " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ ") is not null then (select "+ Widgets.FRIEND_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1)"+ "when (select "+ Widgets.FRIEND_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.FRIEND_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "when (select "+ Widgets.FRIEND_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.FRIEND_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "else "+ Sonet.default_friend_textsize+ " end) as "+ Statuses_styles.FRIEND_TEXTSIZE,"(case when (select " + Widgets.CREATED_TEXTSIZE + " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ ") is not null then (select "+ Widgets.CREATED_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1)"+ "when (select "+ Widgets.CREATED_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.CREATED_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "when (select "+ Widgets.CREATED_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.CREATED_TEXTSIZE+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "else "+ Sonet.default_created_textsize+ " end) as "+ Statuses_styles.CREATED_TEXTSIZE,"(case when (select " + Widgets.MESSAGES_BG_COLOR + " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ ") is not null then (select "+ Widgets.MESSAGES_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1)"+ "when (select "+ Widgets.MESSAGES_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.MESSAGES_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "when (select "+ Widgets.MESSAGES_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.MESSAGES_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "else "+ Sonet.default_message_bg_color+ " end) as "+ Statuses_styles.STATUS_BG,Accounts.SERVICE + " as " + Statuses_styles.ICON,"(case when (select " + Widgets.PROFILES_BG_COLOR + " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ ") is not null then (select "+ Widgets.PROFILES_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1)"+ "when (select "+ Widgets.PROFILES_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.PROFILES_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "when (select "+ Widgets.PROFILES_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.PROFILES_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "else "+ Sonet.default_message_bg_color+ " end) as "+ Statuses_styles.PROFILE_BG,"(case when (select " + Widgets.FRIEND_BG_COLOR + " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ ") is not null then (select "+ Widgets.FRIEND_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "="+ TABLE_ACCOUNTS+ "."+ Accounts._ID+ " limit 1)"+ "when (select "+ Widgets.FRIEND_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.FRIEND_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "="+ mAppWidgetId+ " and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "when (select "+ Widgets.FRIEND_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1) is not null then (select "+ Widgets.FRIEND_BG_COLOR+ " from "+ TABLE_WIDGETS+ " where "+ Widgets.WIDGET+ "=0 and "+ Widgets.ACCOUNT+ "=-1 limit 1)"+ "else "+ Sonet.default_friend_bg_color+ " end) as "+ Statuses_styles.FRIEND_BG},null,null,null);
  SimpleCursorAdapter sca=new SimpleCursorAdapter(ManageAccounts.this,R.layout.widget_item,c,new String[]{Statuses_styles.FRIEND,Statuses_styles.FRIEND + "2",Statuses_styles.MESSAGE,Statuses_styles.MESSAGE + "2",Statuses_styles.STATUS_BG,Statuses_styles.CREATEDTEXT,Statuses_styles.PROFILE,Statuses_styles.ICON,Statuses_styles.PROFILE_BG,Statuses_styles.FRIEND_BG},new int[]{R.id.friend_bg_clear,R.id.friend,R.id.message_bg_clear,R.id.message,R.id.status_bg,R.id.created,R.id.profile,R.id.icon,R.id.profile_bg,R.id.friend_bg});
  sca.setViewBinder(mViewBinder);
  setListAdapter(sca);
}
 

Example 20

From project sthlmtraveling, under directory /src/com/markupartist/sthlmtraveling/.

Source file: SearchDeparturesFragment.java

  22 
vote

private void fillData(){
  final Cursor historyCursor=mHistoryDbAdapter.fetchByType(HistoryDbAdapter.TYPE_DEPARTURE_SITE);
  getActivity().startManagingCursor(historyCursor);
  String[] from=new String[]{HistoryDbAdapter.KEY_NAME};
  int[] to=new int[]{android.R.id.text1};
  final SimpleCursorAdapter favorites=new SimpleCursorAdapter(getActivity(),android.R.layout.simple_list_item_1,historyCursor,from,to);
  getActivity().stopManagingCursor(historyCursor);
  setListAdapter(favorites);
}
 

Example 21

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

Source file: DeploymentSearchTest.java

  22 
vote

@UiThreadTest public void testShowResults(){
  Cursor cursor=MainApplication.mDb.fetchAllDeployments();
  assertTrue("Couldn't fetch deployments from online because app is offline",cursor.getCount() > 0);
  String[] from=new String[]{Database.DEPLOYMENT_ID,Database.DEPLOYMENT_NAME,Database.DEPLOYMENT_DESC,Database.DEPLOYMENT_URL};
  int[] to=new int[]{R.id.deployment_list_id,R.id.deployment_list_name,R.id.deployment_list_desc,R.id.deployment_list_url};
  SimpleCursorAdapter deployments=new SimpleCursorAdapter(mDeploymentSearchActivity,R.layout.deployment_list,cursor,from,to);
  mListView.setAdapter(deployments);
  assertTrue(mListView.getCount() > 0);
  mUshahidiDatabase.deleteAllDeployment();
}
 

Example 22

From project SWADroid, under directory /SWADroid/src/es/ugr/swad/swadroid/modules/rollcall/.

Source file: Rollcall.java

  22 
vote

private void createSpinnerAdapter(){
  Spinner spinner=(Spinner)this.findViewById(R.id.spCourse);
  String where="id = " + Global.getSelectedRollcallCourseCode();
  dbCursor=dbHelper.getDb().getCursor(Global.DB_TABLE_COURSES,where,"name");
  startManagingCursor(dbCursor);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_spinner_item,dbCursor,new String[]{"name"},new int[]{android.R.id.text1});
  spinner.setAdapter(adapter);
  spinner.setEnabled(false);
}
 

Example 23

From project tagin, under directory /android-engine/src/ca/idi/taginsdk/tools/.

Source file: URNMonitor.java

  22 
vote

private void fillData(){
  Cursor mCursor=getContentResolver().query(TaginProvider.URN_FINGERPRINTS_URI,null,null,null,null);
  startManagingCursor(mCursor);
  String[] from=new String[]{TaginDatabase._ID,TaginDatabase.MODIFIED,TaginDatabase.URN};
  int[] to=new int[]{R.id.Row_TextView01,R.id.Row_TextView02,R.id.Row_TextView03};
  SimpleCursorAdapter urns=new SimpleCursorAdapter(this,R.layout.row,mCursor,from,to);
  setListAdapter(urns);
}
 

Example 24

From project Ushahidi_Android, under directory /Core/tests/src/com/ushahidi/android/app/test/.

Source file: DeploymentSearchTest.java

  22 
vote

@UiThreadTest public void testShowResults(){
  Cursor cursor=MainApplication.mDb.fetchAllDeployments();
  assertTrue("Couldn't fetch deployments from online because app is offline",cursor.getCount() > 0);
  String[] from=new String[]{Database.DEPLOYMENT_ID,Database.DEPLOYMENT_NAME,Database.DEPLOYMENT_DESC,Database.DEPLOYMENT_URL};
  int[] to=new int[]{R.id.deployment_list_id,R.id.deployment_list_name,R.id.deployment_list_desc,R.id.deployment_list_url};
  SimpleCursorAdapter deployments=new SimpleCursorAdapter(mDeploymentSearchActivity,R.layout.deployment_list,cursor,from,to);
  mListView.setAdapter(deployments);
  assertTrue(mListView.getCount() > 0);
  mUshahidiDatabase.deleteAllDeployment();
}
 

Example 25

From project Android-SQL-Helper, under directory /tests/AndroidSampleProject/src/com/sgxmobileapps/androidsqlhelper/example/.

Source file: UserListActivity.java

  21 
vote

@Override protected void onResume(){
  super.onResume();
  mDbAdapter.open();
  Cursor cursor=mDbAdapter.getCursorAppUser();
  startManagingCursor(cursor);
  ListAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.two_line_list_item,cursor,new String[]{StorageDbMetadata.AppUser.APPUSER_FIRSTNAME_COL,StorageDbMetadata.AppUser.APPUSER_SURNAME_COL},new int[]{android.R.id.text1,android.R.id.text2});
  setListAdapter(adapter);
}
 

Example 26

From project androidtracks, under directory /src/org/sfcta/cycletracks/.

Source file: MainInput.java

  21 
vote

void populateList(ListView lv){
  DbAdapter mDb=new DbAdapter(MainInput.this);
  mDb.open();
  int cleanedTrips=mDb.cleanTables();
  if (cleanedTrips > 0) {
    Toast.makeText(getBaseContext(),"" + cleanedTrips + " bad trip(s) removed.",Toast.LENGTH_SHORT).show();
  }
  try {
    Cursor allTrips=mDb.fetchAllTrips();
    SimpleCursorAdapter sca=new SimpleCursorAdapter(this,R.layout.twolinelist,allTrips,new String[]{"purp","fancystart","fancyinfo"},new int[]{R.id.TextView01,R.id.TextView03,R.id.TextInfo});
    lv.setAdapter(sca);
    TextView counter=(TextView)findViewById(R.id.TextViewPreviousTrips);
    int numtrips=allTrips.getCount();
switch (numtrips) {
case 0:
      counter.setText("No saved trips.");
    break;
case 1:
  counter.setText("1 saved trip:");
break;
default :
counter.setText("" + numtrips + " saved trips:");
}
}
 catch (SQLException sqle) {
}
mDb.close();
lv.setOnItemClickListener(new AdapterView.OnItemClickListener(){
public void onItemClick(AdapterView<?> parent,View v,int pos,long id){
Intent i=new Intent(MainInput.this,ShowMap.class);
i.putExtra("showtrip",id);
startActivity(i);
}
}
);
registerForContextMenu(lv);
}
 

Example 27

From project callmeter, under directory /src/de/ub0r/android/callmeter/widget/.

Source file: StatsAppWidgetConfigure.java

  21 
vote

/** 
 * Set  {@link SimpleCursorAdapter} for {@link Spinner}. 
 */
private void setAdapter(){
  final Cursor c=this.getContentResolver().query(DataProvider.Plans.CONTENT_URI,PROJ_ADAPTER,DataProvider.Plans.WHERE_PLANS,null,DataProvider.Plans.NAME);
  String[] fieldName;
  if (this.cbShowShortname.isChecked()) {
    fieldName=new String[]{DataProvider.Plans.SHORTNAME};
  }
 else {
    fieldName=new String[]{DataProvider.Plans.NAME};
  }
  final SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_spinner_item,c,fieldName,new int[]{android.R.id.text1});
  final int pos=this.spinner.getSelectedItemPosition();
  this.spinner.setAdapter(adapter);
  if (pos >= 0 && pos < this.spinner.getCount()) {
    this.spinner.setSelection(pos);
  }
}
 

Example 28

From project cw-android, under directory /Database/Constants/src/com/commonsware/android/constants/.

Source file: ConstantsBrowser.java

  21 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  db=new DatabaseHelper(this);
  constantsCursor=db.getReadableDatabase().rawQuery("SELECT _ID, title, value " + "FROM constants ORDER BY title",null);
  ListAdapter adapter=new SimpleCursorAdapter(this,R.layout.row,constantsCursor,new String[]{DatabaseHelper.TITLE,DatabaseHelper.VALUE},new int[]{R.id.title,R.id.value});
  setListAdapter(adapter);
  registerForContextMenu(getListView());
}
 

Example 29

From project cwac-loaderex, under directory /demo/src/com/commonsware/cwac/loaderex/demo/.

Source file: ConstantsBrowser.java

  21 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
  StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().penaltyLog().penaltyDeath().build());
  setContentView(R.layout.main);
  db=new DatabaseHelper(this);
  adapter=new SimpleCursorAdapter(this,R.layout.row,null,new String[]{DatabaseHelper.TITLE,DatabaseHelper.VALUE},new int[]{R.id.title,R.id.value});
  ListView lv=(ListView)findViewById(R.id.constants);
  lv.setAdapter(adapter);
  registerForContextMenu(lv);
  getLoaderManager().initLoader(0,null,this);
}
 

Example 30

From project DigitbooksExamples, under directory /DigitbooksExamples/src/fr/digitbooks/android/examples/chapitre08/.

Source file: RateListActivityOffline.java

  21 
vote

private void updateList(){
  LocalDigitbooksRatingDb dbHelper=new LocalDigitbooksRatingDb(getBaseContext());
  dbHelper.open();
  Cursor cursor=dbHelper.fetchAllRates();
  if (cursor != null && cursor.getCount() != 0) {
    dbHelper.close();
    mEmptyList.setVisibility(View.GONE);
    String[] from=new String[]{"rating","date","comment"};
    int[] to=new int[]{R.id.rating_bar,android.R.id.text1,android.R.id.text2};
    SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,R.layout.rate_list_item,cursor,from,to);
    adapter.setViewBinder(this);
    setListAdapter(adapter);
    startManagingCursor(cursor);
  }
 else {
    showMessage(getString(R.string.empty_list));
  }
}
 

Example 31

From project Diktofon, under directory /app/src/kaljurand_at_gmail_dot_com/diktofon/activity/.

Source file: SpeakerListActivity.java

  21 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ListView lv=getListView();
  lv.setFastScrollEnabled(true);
  GuiUtils.setEmptyView(this,lv,getString(R.string.emptyview_speakers));
  String[] columns=new String[]{Speaker.Columns._ID,Speaker.Columns.NAME};
  int[] to=new int[]{R.id.list_item_speaker_id,R.id.list_item_speaker_name};
  Cursor managedCursor=managedQuery(CONTENT_URI,columns,null,null,Speaker.Columns.NAME + " ASC");
  SimpleCursorAdapter mAdapter=new SimpleCursorAdapter(this,R.layout.list_item_speaker,managedCursor,columns,to);
  lv.setAdapter(mAdapter);
  registerForContextMenu(lv);
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Cursor cursor=(Cursor)parent.getItemAtPosition(position);
      final long key=cursor.getLong(cursor.getColumnIndex(Speaker.Columns._ID));
      Uri selectedSpeakerUri=ContentUris.withAppendedId(CONTENT_URI,key);
      Intent intent=new Intent();
      intent.setData(selectedSpeakerUri);
      setResult(Activity.RESULT_OK,intent);
      finish();
    }
  }
);
}
 

Example 32

From project dreamDroid, under directory /src/net/reichholf/dreamdroid/fragment/.

Source file: ProfileListFragment.java

  21 
vote

public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  mAdapter=new SimpleCursorAdapter(mActivity,android.R.layout.two_line_list_item,mCursor,new String[]{DreamDroid.KEY_PROFILE,DreamDroid.KEY_HOST},new int[]{android.R.id.text1,android.R.id.text2});
  setListAdapter(mAdapter);
  getListView().setOnItemLongClickListener(new OnItemLongClickListener(){
    @Override public boolean onItemLongClick(    AdapterView<?> a,    View v,    int position,    long id){
      return onListItemLongClick(a,v,position,id);
    }
  }
);
}
 

Example 33

From project Gaggle, under directory /src/com/geeksville/gaggle/.

Source file: ListWaypointsActivity.java

  21 
vote

@Override protected BaseAdapter createListAdapter(){
  String[] from=new String[]{LocationLogDbAdapter.KEY_NAME,LocationLogDbAdapter.KEY_DESCRIPTION,WaypointCursor.KEY_DIST_PILOTX,LocationLogDbAdapter.KEY_WAYPOINT_TYPE,WaypointCursor.KEY_DIST_PILOTY};
  int[] to=new int[]{R.id.name,R.id.description,R.id.distance,R.id.image,R.id.units};
  SimpleCursorAdapter a=new SimpleCursorAdapter(this,R.layout.waypoint_row,myCursor,from,to);
  final int distcol=myCursor.getColumnIndex(WaypointCursor.KEY_DIST_PILOTX);
  final int distycol=myCursor.getColumnIndex(WaypointCursor.KEY_DIST_PILOTY);
  final int typecol=myCursor.getColumnIndex(LocationLogDbAdapter.KEY_WAYPOINT_TYPE);
  a.setViewBinder(new SimpleCursorAdapter.ViewBinder(){
    public boolean setViewValue(    View _view,    Cursor cursor,    int columnIndex){
      try {
        if (columnIndex == distcol) {
          TextView view=(TextView)_view;
          int dist=cursor.getInt(distcol);
          String distStr=(dist == -1) ? "---" : Units.instance.metersToDistance(dist);
          view.setText(distStr);
          return true;
        }
        if (columnIndex == distycol) {
          TextView view=(TextView)_view;
          view.setText(Units.instance.getDistanceUnits());
          return true;
        }
        if (columnIndex == typecol) {
          ImageView view=(ImageView)_view;
          ExtendedWaypoint w=((WaypointCursor)cursor).getWaypoint();
          view.setImageDrawable(w.getIcon());
          return true;
        }
      }
 catch (      RuntimeException ex) {
        Log.d("ListWaypoint","Caught exception building waypoint list: " + ex.getMessage());
      }
      return false;
    }
  }
);
  return a;
}
 

Example 34

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

Source file: AddContactActivity.java

  21 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mApp=ImApp.getApplication(this);
  mHandler=new SimpleAlertHandler(this);
  resolveIntent(getIntent());
  setContentView(R.layout.add_contact_activity);
  BrandingResources brandingRes=mApp.getBrandingResource(mProviderId);
  setTitle(brandingRes.getString(BrandingResourceIDs.STRING_ADD_CONTACT_TITLE));
  TextView label=(TextView)findViewById(R.id.input_contact_label);
  label.setText(brandingRes.getString(BrandingResourceIDs.STRING_LABEL_INPUT_CONTACT));
  mAddressList=(MultiAutoCompleteTextView)findViewById(R.id.email);
  mAddressList.setAdapter(new EmailAddressAdapter(this));
  mAddressList.setTokenizer(new Rfc822Tokenizer());
  mAddressList.addTextChangedListener(mTextWatcher);
  mListSpinner=(Spinner)findViewById(R.id.choose_list);
  Cursor c=queryContactLists();
  int initSelection=searchInitListPos(c,getIntent().getStringExtra(ImServiceConstants.EXTRA_INTENT_LIST_NAME));
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_spinner_item,c,new String[]{Imps.ContactList.NAME},new int[]{android.R.id.text1});
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mListSpinner.setAdapter(adapter);
  mListSpinner.setSelection(initSelection);
  mInviteButton=(Button)findViewById(R.id.invite);
  mInviteButton.setText(brandingRes.getString(BrandingResourceIDs.STRING_BUTTON_ADD_CONTACT));
  mInviteButton.setOnClickListener(mButtonHandler);
  mInviteButton.setEnabled(false);
}
 

Example 35

From project greenDAO, under directory /DaoExample/src/de/greenrobot/daoexample/.

Source file: NoteActivity.java

  21 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  DevOpenHelper helper=new DaoMaster.DevOpenHelper(this,"notes-db",null);
  db=helper.getWritableDatabase();
  daoMaster=new DaoMaster(db);
  daoSession=daoMaster.newSession();
  noteDao=daoSession.getNoteDao();
  String textColumn=NoteDao.Properties.Text.columnName;
  String orderBy=textColumn + " COLLATE LOCALIZED ASC";
  cursor=db.query(noteDao.getTablename(),noteDao.getAllColumns(),null,null,null,null,orderBy);
  String[] from={textColumn,NoteDao.Properties.Comment.columnName};
  int[] to={android.R.id.text1,android.R.id.text2};
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_list_item_2,cursor,from,to);
  setListAdapter(adapter);
  editText=(EditText)findViewById(R.id.editTextNote);
  addUiListeners();
}
 

Example 36

From project HapiPodcastJ, under directory /src/info/xuluan/podcast/.

Source file: ChannelsActivity.java

  21 
vote

@Override public void startInit(){
  mCursor=managedQuery(SubscriptionColumns.URI,PROJECTION,null,null,null);
  mAdapter=new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1,mCursor,new String[]{SubscriptionColumns.TITLE},new int[]{android.R.id.text1});
  setListAdapter(mAdapter);
  super.startInit();
}
 

Example 37

From project huiswerk, under directory /print/zxing-1.6/android/src/com/google/zxing/client/android/share/.

Source file: BookmarkPickerActivity.java

  21 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  cursor=getContentResolver().query(Browser.BOOKMARKS_URI,BOOKMARK_PROJECTION,BOOKMARK_SELECTION,null,null);
  startManagingCursor(cursor);
  ListAdapter adapter=new SimpleCursorAdapter(this,R.layout.bookmark_picker_list_item,cursor,BOOKMARK_PROJECTION,TWO_LINE_VIEW_IDS);
  setListAdapter(adapter);
}
 

Example 38

From project imgur-Uploader, under directory /src/com/maass/android/imgur_uploader/.

Source file: History.java

  21 
vote

@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Intent intent=getIntent();
  final Bundle extras=intent.getExtras();
  if (Intent.ACTION_SEND.equals(intent.getAction()) && (extras != null) && extras.containsKey(Intent.EXTRA_STREAM)) {
    final Uri uri=(Uri)extras.getParcelable(Intent.EXTRA_STREAM);
    if (uri != null) {
      final Intent passIntent=new Intent();
      passIntent.setAction(Intent.ACTION_SEND);
      passIntent.putExtra(Intent.EXTRA_STREAM,uri);
      passIntent.setClass(this,ImgurUpload.class);
      startService(passIntent);
      finish();
      return;
    }
  }
  if (histDB == null) {
    final HistoryDatabase histData=new HistoryDatabase(this);
    histDB=histData.getWritableDatabase();
  }
  vCursor=getCursor();
  Log.i(this.getClass().getName(),"Records found: " + vCursor.getCount());
  if (vCursor.getCount() > 0) {
    setContentView(R.layout.history);
    final SimpleCursorAdapter entry=new SimpleCursorAdapter(this,R.layout.history_item,vCursor,new String[]{"local_thumbnail"},new int[]{R.id.ThumbnailImage});
    historyGrid=(GridView)findViewById(R.id.HistoryGridView);
    historyGrid.setAdapter(entry);
    historyGrid.setOnItemClickListener(mMessageClickedHandler);
  }
 else {
    setContentView(R.layout.info);
  }
}
 

Example 39

From project LigiAndroidCommons, under directory /src/org/ligi/android/common/adapter/.

Source file: LinkAndDescriptionAdapter.java

  21 
vote

public static SimpleCursorAdapter createByArray(Context ctx,LinkWithDescription[] links,int resid){
  final String[] matrix={"_id","name","value"};
  final String[] columns={"name","value"};
  final int[] layouts={android.R.id.text1,android.R.id.text2};
  MatrixCursor cursor=new MatrixCursor(matrix);
  int i=0;
  for (  LinkWithDescription link : links) {
    if (link instanceof LinkWithDescriptionAndTitle)     cursor.addRow(new Object[]{i++,((LinkWithDescriptionAndTitle)link).getTitle(),((LinkWithDescriptionAndTitle)link).getDescription()});
 else     cursor.addRow(new Object[]{i++,link.getDescription(),link.getURL()});
  }
  return new SimpleCursorAdapter(ctx,resid,cursor,columns,layouts);
}
 

Example 40

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

Source file: Gallery2.java

  21 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.gallery_2);
  Cursor c=getContentResolver().query(People.CONTENT_URI,null,null,null,null);
  startManagingCursor(c);
  SpinnerAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_gallery_item,c,new String[]{People.NAME},new int[]{android.R.id.text1});
  Gallery g=(Gallery)findViewById(R.id.gallery);
  g.setAdapter(adapter);
}
 

Example 41

From project mobilis, under directory /DemoApps/Magnetizer/src/de/tudresden/inf/rn/mobilis/magnetizer/activities/.

Source file: ChatScreen.java

  21 
vote

private void initMessageList(){
  Log.i(TAG,"initializing message list");
  mMessagesCursor=getContentResolver().query(MessageItems.CONTENT_URI,null,null,null,MessageItems.DEFAULT_SORT_ORDER);
  startManagingCursor(mMessagesCursor);
  ListAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_list_item_2,mMessagesCursor,new String[]{MessageItems.BODY,MessageItems.SENDER},new int[]{android.R.id.text1,android.R.id.text2});
  mLstMessages.setAdapter(adapter);
}
 

Example 42

From project No-Pain-No-Game, under directory /src/edu/ucla/cs/nopainnogame/weightchart/.

Source file: EntryListActivity.java

  21 
vote

private void fillData(){
  Cursor cursor=mDatabase.query("SELECT _id, weight, created_at FROM weight ORDER BY created_at DESC");
  startManagingCursor(cursor);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,R.layout.row,cursor,new String[]{"_id","weight","created_at"},new int[]{R.id.weight,R.id.created_at,R.id.bmi});
  adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder(){
    public boolean setViewValue(    View view,    Cursor cursor,    int columnIndex){
      if (columnIndex == 0) {
        int weight=cursor.getInt(1);
        ((TextView)view).setText(mWeightUnit < 2 ? String.format(getString(mWeightUnit < 1 ? R.string.weight_kg : R.string.weight_lb),.1 * weight) : String.format(getString(R.string.weight_st),weight / 140,weight % 140 * .1));
      }
 else       if (columnIndex == 1) {
        Date date=new Date(1000L * cursor.getInt(2));
        ((TextView)view).setText(DateFormat.getDateFormat(EntryListActivity.this).format(date) + " " + DateFormat.getTimeFormat(EntryListActivity.this).format(date));
      }
 else       if (mBmiFactor > 0) {
        ((TextView)view).setText(String.format(getString(R.string.bmi_value),mBmiFactor * cursor.getInt(1)));
      }
 else {
        view.setVisibility(View.GONE);
      }
      return true;
    }
  }
);
  setListAdapter(adapter);
}
 

Example 43

From project npr-android-app, under directory /src/org/npr/android/news/.

Source file: PlaylistActivity.java

  21 
vote

private void refreshList(){
  String[] cols=new String[]{Items.NAME};
  Cursor cursor=managedQuery(PlaylistProvider.CONTENT_URI,null,Items.IS_READ + " = ?",new String[]{filterUnread ? "0" : "1"},Items.PLAY_ORDER);
  Log.d(LOG_TAG,"" + cursor.getCount());
  startManagingCursor(cursor);
  ListAdapter adapter=new SimpleCursorAdapter(this,R.layout.playlist_item,cursor,cols,new int[]{R.id.PlaylistItemText});
  ListView listView=(ListView)findViewById(R.id.ListView01);
  listView.setAdapter(adapter);
  listView.setOnItemClickListener(this);
}
 

Example 44

From project ohmagePhone, under directory /src/org/ohmage/triggers/types/location/.

Source file: LocTrigSettingsActivity.java

  21 
vote

private void initializeList(){
class CategListViewBinder implements SimpleCursorAdapter.ViewBinder {
    @Override public boolean setViewValue(    View view,    Cursor c,    int colIndex){
switch (view.getId()) {
case R.id.text2:
        TextView tv=(TextView)view;
      Cursor cLocs=mDb.getLocations(c.getInt(colIndex));
    int nLocs=cLocs.getCount();
  cLocs.close();
String locStr=(nLocs == 1) ? " " + getString(R.string.location_on_map) : " " + getString(R.string.locations_on_map);
tv.setText("" + nLocs + locStr);
return true;
}
return false;
}
}
mCursor=mDb.getAllCategories();
mCursor.moveToFirst();
startManagingCursor(mCursor);
String[] from=new String[]{LocTrigDB.KEY_NAME,LocTrigDB.KEY_ID};
int[] to=new int[]{R.id.text1,R.id.text2};
SimpleCursorAdapter categories=new SimpleCursorAdapter(this,R.layout.trigger_loc_settings_row,mCursor,from,to);
categories.setViewBinder(new CategListViewBinder());
setListAdapter(categories);
}
 

Example 45

From project Ohmage_Phone, under directory /src/org/ohmage/triggers/types/location/.

Source file: LocTrigSettingsActivity.java

  21 
vote

private void initializeList(){
class CategListViewBinder implements SimpleCursorAdapter.ViewBinder {
    @Override public boolean setViewValue(    View view,    Cursor c,    int colIndex){
switch (view.getId()) {
case R.id.text2:
        TextView tv=(TextView)view;
      Cursor cLocs=mDb.getLocations(c.getInt(colIndex));
    int nLocs=cLocs.getCount();
  cLocs.close();
String locStr=(nLocs == 1) ? " " + getString(R.string.location_on_map) : " " + getString(R.string.locations_on_map);
tv.setText("" + nLocs + locStr);
return true;
}
return false;
}
}
mCursor=mDb.getAllCategories();
mCursor.moveToFirst();
startManagingCursor(mCursor);
String[] from=new String[]{LocTrigDB.KEY_NAME,LocTrigDB.KEY_ID};
int[] to=new int[]{R.id.text1,R.id.text2};
SimpleCursorAdapter categories=new SimpleCursorAdapter(this,R.layout.trigger_loc_settings_row,mCursor,from,to);
categories.setViewBinder(new CategListViewBinder());
setListAdapter(categories);
}
 

Example 46

From project opensudoku, under directory /OpenSudoku/src/cz/romario/opensudoku/gui/.

Source file: FolderListActivity.java

  21 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.folder_list);
  View getMorePuzzles=(View)findViewById(R.id.get_more_puzzles);
  setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
  getListView().setOnCreateContextMenuListener(this);
  getMorePuzzles.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse("http://code.google.com/p/opensudoku-android/wiki/Puzzles"));
      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      startActivity(intent);
    }
  }
);
  mDatabase=new SudokuDatabase(getApplicationContext());
  mCursor=mDatabase.getFolderList();
  startManagingCursor(mCursor);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,R.layout.folder_list_item,mCursor,new String[]{FolderColumns.NAME,FolderColumns._ID},new int[]{R.id.name,R.id.detail});
  mFolderListBinder=new FolderListViewBinder(this);
  adapter.setViewBinder(mFolderListBinder);
  setListAdapter(adapter);
  Changelog changelog=new Changelog(this);
  changelog.showOnFirstRun();
}
 

Example 47

From project opensudoku-blackberry, under directory /opensudoku/src/net/bmagro/blackberry/opensudoku/gui/.

Source file: FolderListActivity.java

  21 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.folder_list);
  View getMorePuzzles=(View)findViewById(R.id.get_more_puzzles);
  setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
  getListView().setOnCreateContextMenuListener(this);
  getMorePuzzles.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse("http://code.google.com/p/opensudoku-android/wiki/Puzzles"));
      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      startActivity(intent);
    }
  }
);
  mDatabase=new SudokuDatabase(getApplicationContext());
  mCursor=mDatabase.getFolderList();
  startManagingCursor(mCursor);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,R.layout.folder_list_item,mCursor,new String[]{FolderColumns.NAME,FolderColumns._ID},new int[]{R.id.name,R.id.detail});
  mFolderListBinder=new FolderListViewBinder(this);
  adapter.setViewBinder(mFolderListBinder);
  setListAdapter(adapter);
  Changelog changelog=new Changelog(this);
  changelog.showOnFirstRun();
}
 

Example 48

From project PartyWare, under directory /android/src/com/google/zxing/client/android/share/.

Source file: BookmarkPickerActivity.java

  21 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  cursor=getContentResolver().query(Browser.BOOKMARKS_URI,BOOKMARK_PROJECTION,BOOKMARK_SELECTION,null,null);
  startManagingCursor(cursor);
  ListAdapter adapter=new SimpleCursorAdapter(this,R.layout.bookmark_picker_list_item,cursor,BOOKMARK_PROJECTION,TWO_LINE_VIEW_IDS);
  setListAdapter(adapter);
}
 

Example 49

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

Source file: AddContactActivity.java

  21 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mApp=ImApp.getApplication(this);
  mHandler=new SimpleAlertHandler(this);
  resolveIntent(getIntent());
  setContentView(R.layout.add_contact_activity);
  BrandingResources brandingRes=mApp.getBrandingResource(mProviderId);
  setTitle(brandingRes.getString(BrandingResourceIDs.STRING_ADD_CONTACT_TITLE));
  TextView label=(TextView)findViewById(R.id.input_contact_label);
  label.setText(brandingRes.getString(BrandingResourceIDs.STRING_LABEL_INPUT_CONTACT));
  mAddressList=(MultiAutoCompleteTextView)findViewById(R.id.email);
  mAddressList.setAdapter(new EmailAddressAdapter(this));
  mAddressList.setTokenizer(new Rfc822Tokenizer());
  mAddressList.addTextChangedListener(mTextWatcher);
  mListSpinner=(Spinner)findViewById(R.id.choose_list);
  Cursor c=queryContactLists();
  int initSelection=searchInitListPos(c,getIntent().getStringExtra(ImServiceConstants.EXTRA_INTENT_LIST_NAME));
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_spinner_item,c,new String[]{Imps.ContactList.NAME},new int[]{android.R.id.text1});
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mListSpinner.setAdapter(adapter);
  mListSpinner.setSelection(initSelection);
  mInviteButton=(Button)findViewById(R.id.invite);
  mInviteButton.setText(brandingRes.getString(BrandingResourceIDs.STRING_BUTTON_ADD_CONTACT));
  mInviteButton.setOnClickListener(mButtonHandler);
  mInviteButton.setEnabled(false);
}
 

Example 50

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

Source file: VideoBrowserActivity.java

  21 
vote

public void init(){
  setContentView(R.layout.media_picker_activity);
  MakeCursor();
  if (mCursor == null) {
    MusicUtils.displayDatabaseError(this);
    return;
  }
  if (mCursor.getCount() > 0) {
    setTitle(R.string.videos_title);
  }
 else {
    setTitle(R.string.no_videos_title);
  }
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1,mCursor,new String[]{MediaStore.Video.Media.TITLE},new int[]{android.R.id.text1});
  setListAdapter(adapter);
}
 

Example 51

From project Playlist, under directory /src/com/google/zxing/client/android/share/.

Source file: BookmarkPickerActivity.java

  21 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  cursor=getContentResolver().query(Browser.BOOKMARKS_URI,BOOKMARK_PROJECTION,BOOKMARK_SELECTION,null,null);
  startManagingCursor(cursor);
  ListAdapter adapter=new SimpleCursorAdapter(this,R.layout.bookmark_picker_list_item,cursor,BOOKMARK_PROJECTION,TWO_LINE_VIEW_IDS);
  setListAdapter(adapter);
}
 

Example 52

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

Source file: ShoppingListsActivity.java

  21 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Cursor cursor=managedQuery(ShoppingContract.Lists.CONTENT_URI,new String[]{Lists._ID,Lists.NAME},null,null,PreferenceActivity.getShoppingListSortOrderFromPrefs(this));
  setListAdapter(new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1,cursor,new String[]{Lists.NAME},new int[]{android.R.id.text1}));
  Intent intent=getIntent();
  if (intent.getAction().equals(Intent.ACTION_CREATE_SHORTCUT)) {
    setTitle(R.string.pick_list_for_shortcut);
  }
  if (intent.getAction().equals(GeneralIntents.ACTION_INSERT_FROM_EXTRAS)) {
    setTitle(R.string.pick_list_to_insert_items);
  }
}
 

Example 53

From project SyncMyPix, under directory /src/com/nloko/android/syncmypix/.

Source file: SyncResultsActivity.java

  21 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
  SimpleCursorAdapter adapter=(SimpleCursorAdapter)mListview.getAdapter();
switch (item.getItemId()) {
case MENU_FILTER_ALL:
    adapter.getFilter().filter(null);
  return true;
case MENU_FILTER_ERROR:
adapter.getFilter().filter("'" + getString(R.string.resultsdescription_error) + "',"+ "'"+ getString(R.string.resultsdescription_downloadfailed)+ "'");
return true;
case MENU_FILTER_NOTFOUND:
adapter.getFilter().filter("'" + getString(R.string.resultsdescription_notfound) + "'");
return true;
case MENU_FILTER_UPDATED:
adapter.getFilter().filter("'" + getString(R.string.resultsdescription_updated) + "',"+ "'"+ getString(R.string.resultsdescription_multipleprocessed)+ "'");
return true;
case MENU_FILTER_SKIPPED:
adapter.getFilter().filter("'" + getString(R.string.resultsdescription_skippedexists) + "',"+ "'"+ getString(R.string.resultsdescription_skippedunchanged)+ "',"+ "'"+ getString(R.string.resultsdescription_skippedmultiplefound)+ "'");
return true;
}
return false;
}
 

Example 54

From project TABuss, under directory /src/org/ubicompforall/BusTUC/Main/.

Source file: History.java

  21 
vote

@Override public void onCreate(Bundle savedInstance){
  super.onCreate(savedInstance);
  setContentView(R.layout.list);
  dbHelper=new DatabaseHelper(this);
  Cursor cursor=dbHelper.getAllQueries();
  startManagingCursor(cursor);
  columns=new String[]{DatabaseHelper.destination};
  to=new int[]{R.id.destination_entry};
  mAdapter=new SimpleCursorAdapter(this,R.layout.history,cursor,columns,to);
  this.setListAdapter(mAdapter);
}
 

Example 55

From project zirco-browser, under directory /src/org/zirco/ui/activities/.

Source file: AdBlockerWhiteListActivity.java

  21 
vote

/** 
 * Fill the list view.
 */
private void fillData(){
  mCursor=mDbAdapter.getWhiteListCursor();
  startManagingCursor(mCursor);
  String[] from=new String[]{DbAdapter.ADBLOCK_URL};
  int[] to=new int[]{R.id.AdBlockerWhiteListRow_Title};
  mCursorAdapter=new SimpleCursorAdapter(this,R.layout.adblocker_whitelist_row,mCursor,from,to);
  setListAdapter(mCursorAdapter);
  setAnimation();
}
 

Example 56

From project zxing-iphone, under directory /android/src/com/google/zxing/client/android/share/.

Source file: BookmarkPickerActivity.java

  21 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  cursor=getContentResolver().query(Browser.BOOKMARKS_URI,BOOKMARK_PROJECTION,BOOKMARK_SELECTION,null,null);
  startManagingCursor(cursor);
  ListAdapter adapter=new SimpleCursorAdapter(this,R.layout.bookmark_picker_list_item,cursor,BOOKMARK_PROJECTION,TWO_LINE_VIEW_IDS);
  setListAdapter(adapter);
}
 

Example 57

From project android-context, under directory /defunct/.

Source file: ContextBrowserActivity.java

  20 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  tts=new TextToSpeech(this,this);
  Intent intent=null;
  intent=new Intent(this.getApplicationContext(),edu.fsu.cs.contextprovider.sensor.GPSService.class);
  startService(intent);
  intent=new Intent(this.getApplicationContext(),edu.fsu.cs.contextprovider.sensor.NetworkService.class);
  startService(intent);
  intent=new Intent(this.getApplicationContext(),edu.fsu.cs.contextprovider.sensor.AccelerometerService.class);
  startService(intent);
  MovementMonitor.StartThread(5);
  Geocoder geocoder=new Geocoder(this,Locale.getDefault());
  LocationMonitor.StartThread(5,geocoder);
  intent=new Intent(this.getApplicationContext(),edu.fsu.cs.contextprovider.sensor.TelephonyService.class);
  startService(intent);
  contextCursor=managedQuery(ContextProvider.Cntxt.CONTENT_URI,PROJECTION,null,null,null);
  ListAdapter adapter=new SimpleCursorAdapter(this,R.layout.row,contextCursor,new String[]{ContextProvider.Cntxt.TITLE,ContextProvider.Cntxt.VALUE},new int[]{R.id.title,R.id.value});
  setListAdapter(adapter);
  registerForContextMenu(getListView());
}
 

Example 58

From project android-voip-service, under directory /src/main/java/org/linphone/.

Source file: AbstractContactPickerActivity.java

  20 
vote

protected void createCustomPicker(){
  mContactList=(ListView)findViewById(R.id.contactList);
  mcontactFilter=(EditText)findViewById(R.id.contactFilter);
  mcontactFilter.addTextChangedListener(new TextWatcher(){
    public void onTextChanged(    CharSequence s,    int start,    int b,    int c){
    }
    public void beforeTextChanged(    CharSequence s,    int st,    int c,    int a){
    }
    public void afterTextChanged(    Editable s){
      adapter.runQueryOnBackgroundThread(s);
      adapter.getFilter().filter(s.toString());
    }
  }
);
  String[] from=new String[]{col_display_name};
  int[] to=new int[]{android.R.id.text1};
  int layout=android.R.layout.simple_list_item_1;
  adapter=new SimpleCursorAdapter(this,layout,runQuery(null),from,to);
  adapter.setFilterQueryProvider(this);
  mContactList.setAdapter(adapter);
  mContactList.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      final CharSequence contactName=((TextView)view.findViewById(android.R.id.text1)).getText();
      choosePhoneNumberAndDial(contactName,String.valueOf(id));
    }
  }
);
}
 

Example 59

From project apps-for-android, under directory /WikiNotes/src/com/google/android/wikinotes/.

Source file: WikiNotesList.java

  20 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Intent intent=getIntent();
  Uri uri=null;
  String query=null;
  if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
    query=intent.getStringExtra(SearchManager.QUERY);
  }
 else   if (savedInstanceState != null) {
    query=savedInstanceState.getString(SearchManager.QUERY);
  }
  if (query != null && query.length() > 0) {
    uri=Uri.withAppendedPath(WikiNote.Notes.SEARCH_URI,Uri.encode(query));
  }
  if (uri == null) {
    uri=WikiNote.Notes.ALL_NOTES_URI;
  }
  Cursor c=managedQuery(uri,PROJECTION,null,null,WikiNote.Notes.DEFAULT_SORT_ORDER);
  mCursor=c;
  mHelper=new WikiActivityHelper(this);
  ListAdapter adapter=new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1,mCursor,new String[]{WikiNote.Notes.TITLE},new int[]{android.R.id.text1});
  setListAdapter(adapter);
  setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
}
 

Example 60

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

Source file: Certifications.java

  20 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  checkSession();
  setContentView(R.layout.certifications);
  customTitle(getString(R.string.title_Certifications));
  defaultDLPath=Environment.getExternalStorageDirectory() + "/" + Environment.DIRECTORY_DOWNLOADS;
  mPreferences=PreferenceManager.getDefaultSharedPreferences(this);
  listView=(ListView)findViewById(R.id.cert_listView);
  final ContentResolver resolver=getContentResolver();
  Cursor cursor=resolver.query(CertificationsCol.CONTENT_URI,null,null,null,null);
  startManagingCursor(cursor);
  final String[] from=new String[]{CertificationsCol.TITLE};
  final int[] to=new int[]{R.id.cert_textView};
  listView.setAdapter(new SimpleCursorAdapter(getApplicationContext(),R.layout.certifications_row_item,cursor,from,to));
  findViewById(R.id.certificationsProgress).setVisibility(View.GONE);
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (isSdCardAvailable()) {
        view.showContextMenu();
      }
    }
  }
);
  listView.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){
    @Override public void onCreateContextMenu(    ContextMenu menu,    View view,    ContextMenuInfo menuInfo){
      menu.setHeaderTitle(R.string.title_certContextMenu_selectAction);
      getMenuInflater().inflate(R.menu.cert_menu,menu);
    }
  }
);
}
 

Example 61

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: AugmentListView.java

  19 
vote

public AugmentListViewAdapter(Context context,int textViewResourceId,Cursor c,String[] from,int[] to){
  super(context,textViewResourceId,c,from,to);
  setViewBinder(new SimpleCursorAdapter.ViewBinder(){
    public boolean setViewValue(    View view,    Cursor cursor,    int columnIndex){
      int id=view.getId();
switch (id) {
case R.id.Ex:
case R.id.Rare:
        if (cursor.getInt(columnIndex) == 0) {
          view.setVisibility(INVISIBLE);
        }
 else {
          view.setVisibility(VISIBLE);
        }
      return true;
  }
  return false;
}
}
);
}
 

Example 62

From project lullaby, under directory /src/net/sileht/lullaby/.

Source file: SongsActivity.java

  19 
vote

private SimpleCursorAdapter getNewAdapter(){
  int r;
  if (!mStandAloneActivity) {
    r=R.layout.track_list_item_child;
  }
 else {
    r=R.layout.track_list_item_mini;
  }
  return new SongsAdapter(this,this,songsData,r,new String[]{},new int[]{});
}