Here i had added code below in which i had ArrayList Which contains values and then i am adding that values to my named list
NamedList final1 = null;
NamedList<ArrayList<String>> result = null;
ArrayList<String> data=\\ It has values
result.add("Gender",data);
ArrayList<String> data1=\\ It has values
result.add("Group ID",data1);
final1.add("Query",result);
But the code is not working. I don’t know why this code is not working. CAN Any one guide me.
Thanks in advance
You declared
final1to benulland didn’t initialize it before using it.So, when the code:
executes, it throws a
NullPointerException.To fix this, you should initialize
final1before using it. Something like: