简体   繁体   中英

declared arrayList not recognized - android

I declared an ArrayList as follows (as I use to declare it) and then set its content. However, a notice message that I am not using declared "al" variable. 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.

Also, you are creating a new ArrayList, and then discarding the object when you reassign it to 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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM