android.widget.SimpleCursorAdapter.setViewBinder()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中android.widget.SimpleCursorAdapter.setViewBinder()方法的一些代码示例,展示了SimpleCursorAdapter.setViewBinder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SimpleCursorAdapter.setViewBinder()方法的具体详情如下:
包路径:android.widget.SimpleCursorAdapter
类名称:SimpleCursorAdapter
方法名:setViewBinder

SimpleCursorAdapter.setViewBinder介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onViewCreated(View view, Bundle state) {
 super.onViewCreated(view, state);
 SimpleCursorAdapter adapter=
  new SimpleCursorAdapter(getActivity(),
              R.layout.row,
              null,
              new String[] {
                DatabaseHelper.TITLE,
                DatabaseHelper.PROFILE_IMAGE
              },
              new int[] { R.id.title, R.id.icon },
              0);
 adapter.setViewBinder(new QuestionBinder());
 setListAdapter(adapter);
}

代码示例来源:origin: stackoverflow.com

SimpleCursorAdapter simpleCursorAdapter = new SimpleCursorAdapter(..);
simpleCursorAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
  public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
    if(columnIndex == someColumnValue) {
        TextView text = (TextView) view;  // get your View
        text.setText(String.valueOf(cursor.getInt(1)/100));  //set some data
        return true;
    }
    return false;
  }
});

代码示例来源:origin: com.novoda.imageloader/imageloader-demo

private void setAdapter() {
  SimpleCursorAdapter adapter = initAdapter();
  ViewBinder binder = getViewBinder();
  if (binder != null) {
    adapter.setViewBinder(binder);
  }
  view.setAdapter(adapter);
}

代码示例来源:origin: oVirt/moVirt

@Override
protected CursorAdapter createCursorAdapter() {
  SimpleCursorAdapter storageDomainListAdapter = new SimpleCursorAdapter(getActivity(),
      R.layout.storage_domain_list_item,
      null,
      new String[]{NAME, STATUS},
      new int[]{R.id.storage_domain_name, R.id.storage_domain_status}, 0);
  storageDomainListAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
    @Override
    public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
      if (columnIndex == cursor.getColumnIndex(NAME)) {
        TextView textView = (TextView) view;
        String name = cursor.getString(cursor.getColumnIndex(NAME));
        textView.setText(name);
      } else if (columnIndex == cursor.getColumnIndex(STATUS)) {
        ImageView imageView = (ImageView) view;
        String statusString = cursor.getString(cursor.getColumnIndex(STATUS));
        imageView.setImageResource(StorageDomainStatus.fromString(statusString).getResource());
      }
      return true;
    }
  });
  return storageDomainListAdapter;
}

代码示例来源:origin: oVirt/moVirt

@Override
protected CursorAdapter createCursorAdapter() {
  SimpleCursorAdapter diskListAdapter = new SimpleCursorAdapter(getActivity(),
      R.layout.disk_list_item,
      null,
      new String[]{NAME, SIZE, STATUS},
      new int[]{R.id.disk_name, R.id.disk_size, R.id.disk_status}, 0);
  diskListAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
    @Override
    public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
      TextView textView = (TextView) view;
      if (columnIndex == cursor.getColumnIndex(NAME)) {
        String name = cursor.getString(columnIndex);
        textView.setText(name);
      } else if (columnIndex == cursor.getColumnIndex(SIZE)) {
        long size = cursor.getLong(columnIndex);
        String sizeText = (size == -1) ? getString(R.string.disk_unknown_size) : new MemorySize(size).toString();
        textView.setText(sizeText);
      } else if (columnIndex == cursor.getColumnIndex(STATUS)) {
        String status = cursor.getString(columnIndex);
        textView.setText(status == null ? getString(R.string.NA) : status.toUpperCase());
      }
      return true;
    }
  });
  return diskListAdapter;
}

代码示例来源:origin: oVirt/moVirt

@Override
protected CursorAdapter createCursorAdapter() {
  SimpleCursorAdapter snapshotListAdapter = new SimpleCursorAdapter(getActivity(),
      R.layout.snapshot_list_item,
      null,
      new String[]{NAME, SNAPSHOT_STATUS, DATE, PERSIST_MEMORYSTATE},
      new int[]{R.id.snapshot_description, R.id.snapshot_status, R.id.snapshot_date, R.id.snapshot_persist_memorystate}, 0);
  snapshotListAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
    @Override
    public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
      TextView textView = (TextView) view;
      if (columnIndex == cursor.getColumnIndex(NAME)) {
        String name = cursor.getString(columnIndex);
        textView.setText(name);
      } else if (columnIndex == cursor.getColumnIndex(DATE)) {
        String date = DateUtils.convertDateToString(getActivity(), cursor.getLong(columnIndex));
        textView.setText(date);
      } else if (columnIndex == cursor.getColumnIndex(SNAPSHOT_STATUS)) {
        String status = cursor.getString(columnIndex);
        textView.setText(status == null ? getString(R.string.NA) : status.replace("_", " ").toUpperCase());
      } else if (columnIndex == cursor.getColumnIndex(PERSIST_MEMORYSTATE)) {
        textView.setText(getString(R.string.snapshot_memory));
        textView.setVisibility((new CursorHelper(cursor)).getBoolean(columnIndex) ? View.VISIBLE : View.GONE);
      }
      return true;
    }
  });
  return snapshotListAdapter;
}

代码示例来源:origin: oVirt/moVirt

@Override
protected CursorAdapter createCursorAdapter() {
  SimpleCursorAdapter diskListAdapter = new SimpleCursorAdapter(getActivity(),
      R.layout.disk_list_item,
      null,
      new String[]{NAME, SIZE, STATUS},
      new int[]{R.id.disk_name, R.id.disk_size, R.id.disk_status}, 0);
  diskListAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
    @Override
    public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
      TextView textView = (TextView) view;
      if (columnIndex == cursor.getColumnIndex(NAME)) {
        String name = cursor.getString(columnIndex);
        textView.setText(name);
      } else if (columnIndex == cursor.getColumnIndex(SIZE)) {
        long size = cursor.getLong(columnIndex);
        String sizeText = (size == -1) ? getString(R.string.disk_unknown_size) : new MemorySize(size).toString();
        textView.setText(sizeText);
      } else if (columnIndex == cursor.getColumnIndex(STATUS)) {
        String status = cursor.getString(columnIndex);
        textView.setText(status == null ? getString(R.string.NA) : status.toUpperCase());
      }
      return true;
    }
  });
  return diskListAdapter;
}

代码示例来源:origin: oVirt/moVirt

new int[]{R.id.name, R.id.status, R.id.statistics}, 0);
hostListAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
  @Override
  public boolean setViewValue(View view, Cursor cursor, int columnIndex) {

代码示例来源:origin: oVirt/moVirt

new String[]{NAME, STATUS, CPU_USAGE},
    new int[]{R.id.name, R.id.status, R.id.statistics}, 0);
vmListAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
  @Override
  public boolean setViewValue(View view, Cursor cursor, int columnIndex) {

代码示例来源:origin: oVirt/moVirt

new String[]{NAME, LINKED, PLUGGED},
    new int[]{R.id.nic_mac, R.id.nic_status, R.id.nic_para}, 0);
nicListAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
  @Override
  public boolean setViewValue(View view, Cursor cursor, int columnIndex) {

代码示例来源:origin: oVirt/moVirt

new String[]{NAME, LINKED, PLUGGED},
    new int[]{R.id.nic_mac, R.id.nic_status, R.id.nic_para}, 0);
nicListAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
  @Override
  public boolean setViewValue(View view, Cursor cursor, int columnIndex) {

代码示例来源:origin: THEONE10211024/ApiDemos

new int[] { android.R.id.text1, android.R.id.text2 });
adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
  public boolean setViewValue(View view, Cursor cursor, int columnIndex) {

代码示例来源:origin: qiubiteme/android_api_demos

new int[] { android.R.id.text1, android.R.id.text2 });
adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
  public boolean setViewValue(View view, Cursor cursor, int columnIndex) {

代码示例来源:origin: be.e_contract.jwatchdog/jwatchdog-android

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
    Bundle savedInstanceState) {
  Log.d(Constants.TAG, "onCreateView");
  View view = super.onCreateView(inflater, container, savedInstanceState);
  Context context = getActivity().getApplicationContext();
  this.simpleCursorAdapter = new SimpleCursorAdapter(context,
      R.layout.row, null, new String[] {
          DatabaseHelper.NOTIFICATIONS_MESSAGE_COL,
          DatabaseHelper.NOTIFICATIONS_TIMESTAMP_COL },
      new int[] { R.id.messageTextView, R.id.timestampTextView });
  this.simpleCursorAdapter.setViewBinder(new NotificationViewBinder(context));
  setListAdapter(this.simpleCursorAdapter);
  getLoaderManager().initLoader(0, null, this);
  return view;
}

代码示例来源:origin: oVirt/moVirt

new String[]{NAME, STATUS},
    new int[]{R.id.vm_name, R.id.vm_status}, 0);
vmListAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
  @Override
  public boolean setViewValue(View view, Cursor cursor, int columnIndex) {

代码示例来源:origin: ogarcia/opensudoku

new int[]{R.id.sudoku_board, R.id.state, R.id.time,
        R.id.last_played, R.id.created, R.id.note});
mAdapter.setViewBinder(new SudokuListViewBinder(this));
updateList();
setListAdapter(mAdapter);

代码示例来源:origin: google/ringdroid

0);
mAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
    public boolean setViewValue(View view,
                  Cursor cursor,

代码示例来源:origin: openbmap/radiocells-scanner-android

/**
 * 
 */
private void initData() {
  final DataHelper dataHelper = new DataHelper(getActivity());
  mSession = dataHelper.getActiveSessionId();
  final String[] from = new String[] {
      Schema.COL_ACTUAL_CELLID,
      Schema.COL_OPERATORNAME,
      Schema.COL_NETWORKTYPE,
      Schema.COL_AREA
  };
  final int[] to = new int[] {
      R.id.textViewCellID,
      R.id.textViewOperator,
      R.id.textViewNetworkType,
      R.id.textViewArea
  };
  mAdapter = new SimpleCursorAdapter(getActivity().getBaseContext(),
      R.layout.celllistitems, null, from, to, 0);
  mAdapter.setViewBinder(new NetworkTypeDescriptionViewBinder());
  setListAdapter(mAdapter);
}

代码示例来源:origin: ogarcia/opensudoku

@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);
  // Inform the list we provide context menus for items
  getListView().setOnCreateContextMenuListener(this);
  getMorePuzzles.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://opensudoku.moire.org"));
      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);
  // show changelog on first run
  Changelog changelog = new Changelog(this);
  changelog.showOnFirstRun();
}

代码示例来源:origin: openbmap/radiocells-scanner-android

private void initData() {
  final DataHelper dataHelper = new DataHelper(getActivity());
  mSession = dataHelper.getActiveSessionId();
  
  final String[] from = new String []{
      Schema.COL_ID,
      Schema.COL_BSSID,
      Schema.COL_SSID,
      "MAX(" + Schema.COL_LEVEL + ")",
      /*Schema.COL_IS_NEW_WIFI,*/
      Schema.COL_KNOWN_WIFI,
      Schema.COL_CAPABILITIES};
  final int[] to = new int [] {
      R.id.wifilistfragment_id,
      R.id.wifilistfragment_bssid,
      R.id.wifilistfragment_ssid,
      R.id.wifilistfragment_level,
      R.id.wifilistfragment_statusicon,
      R.id.wifilistfragment_capabilities};
  mAdapter = new SimpleCursorAdapter(getActivity().getBaseContext(),
      R.layout.wifilistitems, null, from, to, 0);
  mAdapter.setViewBinder(new WifiViewBinder());
  setListAdapter(mAdapter);
}

相关文章