Iam trying to create a List View for the below Json code
{"ImageList" :[
{
"ENO":"87",
"ENAME" : "john",
"EJOB":"clerk",
},{
"ENO":"21",
"ENAME" : "Abdul",
"EJOB":"Manager",
} ]
}
This the DataControl Program This DataControl is invoked by another Class
Runnable mcsJob = new Runnable(){
public void run(){
try {
CustomAPI customApi = mobileBackend.getServiceProxyCustomApi();
MCSRequest request = new MCSRequest(mobileBackend.getMbeConfiguration());
request.setConnectionName(mafConnection);
request.setRequestURI(requestURI);
request.setHttpMethod(httpMethod);
request.setPayload(payload==null?"":payload);
request.setRetryLimit(0);
HashMap<String,String> headers = new HashMap<String,String>();
if(httpHeaders!=null)
{
headers.putAll(httpHeaders);
}
request.setHttpHeaders(headers);
MCSResponse response = customApi.sendForStringResponse(request);
String jsonResponse = (String) response.getMessage();
setEmployeeSearchResponse(jsonResponse);
//Converting JSON string
apiResponse.setEmpsearchResponse(employeeSearchResponse);
JSONObject jsonObject = new JSONObject(apiResponse.getEmpsearchResponse());
JSONObject bodyObject = jsonObject.getJSONObject("Body");
JSONObject ProcessObject=bodyObject.getJSONObject("processResponse");
JSONArray empObject=ProcessObject.getJSONArray("ImageList");
for(int i=0;i<empObject.length();i++)
{
JSONObject js = empObject.getJSONObject(i);
String name= ""+js.getString("ENO");
String photo = ""+js.getString("ENAME");
String empno=""+js.getString("EJOB");
EmployeeSearchPOJO empo=new EmployeeSearchPOJO();
empo.setEMPNO(empno);
empo.setENAME(name);
empo.setPHOTO(photo);
employeeList.add(empo);
}
}
Then I will return the List
I have created EmployeeSearchPOJO class
List I have created is
List<EmployeeSearchPOJO> employeeList=new ArrayList<EmployeeSearchPOJO>();
public void setEmployeeList(List<EmployeeSearchPOJO> employeeList) {
this.employeeList = employeeList;
}
public List<EmployeeSearchPOJO> getEmployeeList() {
return employeeList;
}