2015-11-30 67 views
1

TodoManager.getInstance()是一个新的TodoManager对象,每一行都有所不同,我有自己的适配器。我在int处使用int位置(该行为元素)。我需要changesetStatus()我的基类的方法。如何对我在这里获得int位置? pos是第i项微调,这不能作为位置Android Spinner

public void onItemSelected(AdapterView<?> parent, View view, 
            int pos, long id) { 
      // TODO Auto-generated method stub 
      String selectedItem = parent.getItemAtPosition(pos).toString(); 
      TodoManager.getInstance().getTodo(pos).setStatus(selectedItem); 
// more code 

回答

0

你可以尝试在微调您的项目索引标签关联。你应该在使微调器膨胀之前做到这一点。您可以将标签与View方法关联起来:setTag(int key, Object tag)潜在微调列表项目的方法。然后在onItemSelected方法中,您可以使用View.findViewWithTag()检索正确的对象。