Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `String url="http://27.147.169.230/UpSkillService/UpSkillsService.svc/"+"GetCNCCourseDefByorg/"+1+"/"+1;
- Ion.with(getApplicationContext())
- .load("GET",url)
- .setBodyParameter("","")
- .asString()
- .setCallback(new FutureCallback<String>() {
- @Override
- public void onCompleted(Exception e, String result) {
- Log.d("Result",result);
- try {
- JSONObject obj =new JSONObject(result);
- JSONArray jsonArray = obj.getJSONArray("GetCNCCourseDefByorgResult");
- //Arrays.sort(new JSONArray[]{jsonArray});
- if(obj.isNull("GetCNCCourseDefByorgResult"))
- {
- Toast.makeText(getApplicationContext(),"No Course Found",Toast.LENGTH_SHORT).show();
- }
- else if (!obj.equals(null)) {
- String cata="";
- Log.d("Resul3", jsonArray.toString());
- for (int i = 0; i < jsonArray.length(); i++) {
- final CourseCatagory catagoryModel = new CourseCatagory();
- JSONObject course = jsonArray.getJSONObject(i);
- CourseList courselist = new CourseList();
- if(cata!=course.getString("CategoryName"))
- {
- Log.d("Catagory",cata);
- catagoryModel.setCategoryName(course.getString("CategoryName"));
- arrayListcatagory.add(catagoryModel);
- for (int j=0;j<jsonArray.length();j++)
- {
- JSONObject cat1 = jsonArray.getJSONObject(j);
- cata=cat1.getString("CategoryName");
- Log.d("cat",cata);
- if(cat1.getString("CategoryName")==course.getString("CategoryName"))
- {
- courselist.setCourseName(cat1.getString("CourseName"));
- courselist.setCourseCode(cat1.getString("CourseCode"));
- courselist.setWishFlag(cat1.getInt("WishFlag"));
- Log.d("Course",cat1.getString("CourseName"));
- arrayListcourse.add(courselist);
- }
- else {
- }
- }
- }
- catagoryModel.setCourseList(arrayListcourse);
- }
- adapter.notifyDataSetChanged();
- }
- } catch (JSONException e1) {
- e1.printStackTrace();
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement