列表视图在外部按钮点击时读取所有数据?

时间:2016-07-02 12:32:26

标签: android

这是我从listview读取数据的代码,但是它的只读数据在显示中看到但未在数据下面读取。

这里下面是code.it执行8次,在我的显示器上看到8条记录。 我的列表视图中有20条记录。

如何阅读所有数据。?

for(int i = 0; i< listEditTest.getAdapter().getCount();i++){

            View convertView = listEditTest.getChildAt(i);

            TextView TestName = (TextView) convertView.findViewById(R.id.txt_test_edit_name);
            TextView TestValue = (TextView) convertView.findViewById(R.id.txt_result_edit_val);
            EditText TestEditValue = (EditText) convertView.findViewById(R.id.et_result_edit_para_val);
            TextView TestAppId  = (TextView) convertView.findViewById(R.id.txt_test_AppId);
            TextView TestAppTestId  = (TextView) convertView.findViewById(R.id.txt_test_AppTestId);
            TextView TestResultId  = (TextView) convertView.findViewById(R.id.txt_test_AppTestResultId);
            TextView TestProfileName  = (TextView) convertView.findViewById(R.id.txt_test_ProfileName);
            TextView TestParameter  = (TextView) convertView.findViewById(R.id.txt_test_testParameterName);
            TextView TestParaDesc  = (TextView) convertView.findViewById(R.id.txt_test_testParaDesc);
            Log.d("value",TestEditValue.getText().toString());


            String stTName = TestName.getText().toString();
            String stTValue = TestValue.getText().toString();
            String stTEditValue = TestEditValue.getText().toString();
            String stAppIds = TestAppId.getText().toString();
            String stAppTestId = TestAppTestId.getText().toString();
            String stResultId = TestResultId.getText().toString();
            String stProfileName = TestProfileName.getText().toString();
            String stPara = TestParameter.getText().toString();
            String stParaDesc = TestParaDesc.getText().toString();

            try {
                JSONObject jsonObject = new JSONObject();
                jsonObject.accumulate("AppointmentID", stAppIds);
                jsonObject.accumulate("AppointmentTestID", stAppTestId);
                jsonObject.accumulate("TestResultID", stResultId);
                jsonObject.accumulate("TestProfileName", stProfileName);
                jsonObject.accumulate("TestName", stPara);
                jsonObject.accumulate("TestParameter", stTName);
                jsonObject.accumulate("TestParameterDescription", stParaDesc);
                jsonObject.accumulate("TestParameterValue", stTValue);
                jsonObject.accumulate("TestParameterUpdatedValue", stTEditValue);
                jsonArray.put(jsonObject);

            } catch (Exception e) {

                Toast.makeText(EditPatientTest.this, "Something went wrong.", Toast.LENGTH_SHORT).show();
            }

        }

0 个答案:

没有答案