似乎無法從類私有類陣列適配器警告
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
發佈更多的代碼你試過的東西.... –