2016-10-21 5 views
0

カスタムリストビューとテキストビュー、チェックボックス、編集テキストがあります。私はリストビューの行を繰り返し、textview、checkbox、およびedittextの値を取りたいと思っています。反復がページの最後まで来ると、目に見えない行ウィジェットの値を取得してクラッシュすることはできません。私はリストビューを自動的にスクロールダウンする必要があります。この問題を解決するにはどうすればよいですか?Androidカスタムリストビュー= null問題

注:私は12行を持っていますが、6行目の後でクラッシュします.CZは7行目を私のリストビューのscrolldownなしで見ることができません。

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メソッド()がある場合はで私のコードを確認してください:

は、これは私のコードですか? [how-to-get-listview-position]を見てください(http://stackoverflow.com/questions/6014743/how-to-get-listview-position) –

+0

あなたのクエストを編集してあなたの答えを削除してそこのあなたのコードは、 –

答えて

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()); 

} 
} 
関連する問題