2016-10-21 29 views
0

我有一个自定义列表视图和textview,复选框,编辑文本。我想迭代我的列表视图行,并想采取textview,复选框和edittext值。当迭代到达页面结束时不能取不可见的行窗口小部件值和崩溃。我必须自动向下滚动我的列表视图。我该如何解决这个问题?Android自定义列表视图= null问题

注:我有12行,但它在第6行后崩溃cz无法看到第7行没有scrolldown我的listview。

这是我的代码:

public void onSave(View view) { 
     ArrayList<String> olcum = new ArrayList<String>(); 
     ArrayList<String> orneklemebuyukluk = new ArrayList<String>(); 
     EditText et; 
     CheckBox chx; 
     TextView buyukluk; 
     String nitel="0"; 
     for (int i = 0; i < list_olcum_view.getCount(); i++) { 
      view = list_olcum_view.getChildAt(i); 
      et = (EditText) view.findViewById(R.id.edt_olcum); 
      chx=(CheckBox)view.findViewById(R.id.txt_orneklemenitel); 
      olcum.add(et.getText().toString()); 

     } 
} 
+0

请在下面 –

+0

哪里是你的适配器和getView(),您可以获取列表项的位置,检查我的代码?看看[如何获得列表视图位置](http://stackoverflow.com/questions/6014743/how-to-get-listview-position) –

+0

请删除你的答案,因为我编辑你的queston并把你的代码在那里 - –

回答

0
Note: I have 12 rows but it crashs after 6th row cz cannot see 7th row without scrolldown my listview. 

public void onSave(View view) { 
     ArrayList<String> olcum = new ArrayList<String>(); 
     ArrayList<String> orneklemebuyukluk = new ArrayList<String>(); 
     EditText et; 
     CheckBox chx; 
     TextView buyukluk; 
     String nitel="0"; 
     for (int i = 0; i < list_olcum_view.getCount(); i++) { 
      view = list_olcum_view.getChildAt(i); 
      et = (EditText) view.findViewById(R.id.edt_olcum); 
      chx=(CheckBox)view.findViewById(R.id.txt_orneklemenitel); 
      olcum.add(et.getText().toString()); 

} 
}