Android 未识别TextView变量数组
我试图创建一个Android 未识别TextView变量数组,android,textview,Android,Textview,我试图创建一个textviews变量数组,如下所示,但eclipse用红色波浪线强调数组中存储的textview变量。我不知道为什么 Java_代码: int [] viewsRefsIds = {R.id.reportLocNameValue, R.id.reportLocLatValue, R.id.reportLocLngValue, R.id.reportTimeValue, R.id.reportDateValue, R.id.reportImg
textviews
变量数组,如下所示,但eclipse用红色波浪线强调数组中存储的textview
变量。我不知道为什么
Java_代码:
int [] viewsRefsIds = {R.id.reportLocNameValue, R.id.reportLocLatValue, R.id.reportLocLngValue, R.id.reportTimeValue,
R.id.reportDateValue, R.id.reportImgTitleValue, R.id.reportImgPathValue
};
TextView [] viewsVariables = {reportAlertDialogLocName, reportAlertDialogLocLat, reportAlertDialogLocLng,
reportAlertDialogTime, reportAlertDialogDate, reportAlertDialogImgTitle, reportAlertDialogImgPath
};
TextView reportAlertDialogMSG = (TextView) reportAlertDialog.findViewById(R.id.reportDialogMessageID);
reportAlertDialogMSG.setText(REPORT_ALERT_DIALOG_MSG);
for (int i=0; i<bundleVals.length; i++) {
viewsVariables[i] = (TextView) reportAlertDialog.findViewById(viewsRefsIds[i]);
}
int[]viewsRefsIds={R.id.reportLocNameValue,R.id.reportLocLatValue,R.id.reportLocLngValue,R.id.reportTimeValue,
R.id.reportDateValue,R.id.reportImgTitleValue,R.id.reportImgPathValue
};
TextView[]viewsVariables={reportAlertDialogLocName,reportAlertDialogLocLat,reportAlertDialogLocLng,
reportAlertDialogTime、reportAlertDialogDate、reportAlertDialogImgTitle、reportAlertDialogImgPath
};
TextView reportAlertDialogMSG=(TextView)reportAlertDialog.findViewById(R.id.reportDialogMessageID);
reportAlertDialogMSG.setText(REPORT\u ALERT\u DIALOG\u MSG);
对于(inti=0;i对于我来说这是有效的
int[] viewsRefsIds = {R.id.text,...};
TextView[] viewsVariables = new TextView[viewsRefsIds.length];
for (int i=0; i<viewsRefsIds.length; i++) {
viewsVariables[i] = (TextView)findViewById(viewsRefsIds[i]);
}
int[]viewsRefsIds={R.id.text,…};
TextView[]viewsVariables=newtextView[viewsRefsIds.length];
for(int i=0;i您尝试了什么?我将发布一个答案…如上面的for循环所示,我想从数组“viewsVariables”中检索textview变量,并为检索到的变量赋值。是否清楚,或者还没有足够的yeti也尝试了这一点,但eclipse无法识别它。我不知道为什么?