似乎无法从类私有类阵列适配器警告
public class MainActivity extends Activity {
EditText nameTxt, ageTxt, nationalityTxt, genderTxt, icnuTxt, dobTxt, pobTxt, heightTxt, weightTxt, bloodTypeTxt, bloodPressureTxt;
ArrayList<PatientDetails> Details = new ArrayList<PatientDetails>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
private class PatientDetailsAdapter extends ArrayAdapter<PatientDetails>{
public PatientDetailsAdapter(){
super(MainActivity.this, R.layout.details_list, Details);
}
@Override
public View getView(int position, View view, ViewGroup parent){
if (view == null)
view = getLayoutInflater().inflate(R.layout.details_list, parent, false);
PatientDetails currentPatientDetails = Details.get(position);
TextView name = (TextView) view.findViewById(R.id.patientName);
name.setText(currentPatientDetails.getName());
TextView age = (TextView) view.findViewById(R.id.patientAge);
age.setText(currentPatientDetails.getAge());
TextView icnu = (TextView) view.findViewById(R.id.patientIcnu);
icnu.setText(currentPatientDetails.getIcnu());
TextView gender = (TextView) view.findViewById(R.id.patientGender);
gender.setText(currentPatientDetails.getGender());
TextView nationality = (TextView) view.findViewById(R.id.patientNationality);
nationality.setText(currentPatientDetails.getNationality());
TextView dob = (TextView) view.findViewById(R.id.patientDob);
dob.setText(currentPatientDetails.getDob());
TextView pob = (TextView) view.findViewById(R.id.patientPob);
pob.setText(currentPatientDetails.getPob());
TextView height = (TextView) view.findViewById(R.id.patientHeight);
height.setText(currentPatientDetails.getHeight());
TextView weight = (TextView) view.findViewById(R.id.patientWeight);
weight.setText(currentPatientDetails.getWeight());
TextView bloodType = (TextView) view.findViewById(R.id.patientBloodType);
bloodType.setText(currentPatientDetails.getBloodType());
TextView bloodPressure = (TextView) view.findViewById(R.id.patientBloodPressure);
bloodPressure.setText(currentPatientDetails.getBloodPressure());
return view;
}
}
删除警告它详细介绍了PatientDetailsAdapter黄色下划线并说:
类型MainActivity.PatientListAdapter是从未在本地使用
我已经添加了公共类活动以及一些私人类 其应用程序添加患者详细信息和详细信息列表
您是否创建了该类的一个实例?我尝试创建私人课程时遇到错误,因为如果它是私人课程,您将如何使用它。 – kai
一个带有公共构造函数的私有类? – donfuxx
发布更多的代码你试过的东西.... –