Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 未识别TextView变量数组_Android_Textview - Fatal编程技术网

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无法识别它。我不知道为什么?