예제 #1
0
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    mAdapter.swapCursor(data);

    final int totalActions = mAdapter.getCount();
    final String strTotalActions;
    if (totalActions == 0) {
      strTotalActions = "Nenhuma ação";
    } else if (totalActions == 1) {
      strTotalActions = "1 ação";
    } else {
      strTotalActions = totalActions + " ações";
    }
    mTxtTotalActions.setText(strTotalActions);
    for (int position = 0; position < totalActions; position++) {
      View convertView = null;
      if (mViewList.size() > position) {
        convertView = mViewList.get(position);
      }
      final View view = mAdapter.getView(position, convertView, mLayInsertionPoint);
      if (convertView == null) {
        mViewList.add(view);
        mLayInsertionPoint.addView(view);
      }
    }
  }
예제 #2
0
 @Override
 public void onLoaderReset(Loader<Cursor> loader) {
   mAdapter.swapCursor(null);
 }