如何将项添加到已填充的SimpleCursorAdapter?

时间:2017-04-23 07:25:52

标签: android simplecursoradapter android-cursoradapter android-cursor

我正在使用CursorLoader从内容提供商处获取类别。数据正在SimpleCursorAdapter中填充,并显示在下拉菜单(微调器)中。 问题是,我需要在列表中添加一个将首先显示的项目。 我怎么能这样做?

以下是代码:

CursorLoader cl = new CursorLoader(Main2Activity.this, 
        ContentProvider.createUri(Category.class, null), null, null, null, 
        "name ASC");
Cursor cursor = cl.loadInBackground();
final SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(Main2Activity.this,
      android.R.layout.simple_spinner_item,
      cursor,
      new String[]{"name"},
      new int[]{android.R.id.text1},
      0);
cursor.close();

0 个答案:

没有答案
相关问题