[英]declared arrayList not recognized - android
I declared an ArrayList
as follows (as I use to declare it) and then set its content. 我声明了一个ArrayList
,如下所示(就像我以前声明的那样),然后设置它的内容。 However, a notice message that I am not using declared "al"
variable. 但是,一条通知消息说我没有使用声明的"al"
变量。 It doesn't dissapear although I use it at following line. 尽管我在下一行使用它,但它并没有消失。 Content is also not set! 内容也没有设置! Strange... why? 奇怪...为什么? Thank you 谢谢
ArrayList<String> al = new ArrayList<String>();
al = parsedExampleDataSet.getView();
It means you are setting it but never reading it. 这意味着您正在设置它,但从未阅读。
Apparently, you never access al except to assign it. 显然,除了分配它之外,您永远不会访问al。
Also, you are creating a new ArrayList, and then discarding the object when you reassign it to parsedExampleDataSet.getView()
. 同样,您要创建一个新的ArrayList,然后在将该对象重新分配给parsedExampleDataSet.getView()
时将其丢弃。 This probably has nothing to do with your error, but it's a waste. 这可能与您的错误无关,但这很浪费。
try this: 尝试这个:
ArrayList<String> al = null;
al = parsedExampleDataSet.getView();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.