How to cast activity to fragment by converting activity to fragment? : As a beginner, I am struggling here to solve one issue in my programming code. 

I have Navigation drawer -> If I click item from the Navigation drawer, it opens the separate Fragment which has two tabs named as "Lists" and "Photos".

My aim is , When I click the first tab ie. "Lists tab", I am trying to call "Listclassfragment class" which has to display listview. When I click or swipe the second tab ie. photos tab, "photosfragment" class will be called and it has to show photos in grid. I am achieving this by using ViewPagerAdapter 

When I try to work on ListClassFragment, I am getting the Error, 

**Error :  incompatible types: Activity cannot be converted to ListClassFragment**


**ListClassFragment class:**

    public class ListClassFragment extends Fragment {
    private ListView listview;
    private ArrayList<ListView_Model> books;
    private ArrayAdapter<ListView_Model> adapter;

    private final static String TAG = ListClassFragment.class.getSimpleName();

    private final static String url = "http://myfee.org/apps/customer?id=1";


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        // Inflate the layout for this fragment
        View view =  inflater.inflate(R.layout.activity_listview, container, false);

        listview = (ListView) view.findViewById(R.id.listview);
        setListViewAdapter();
        getDataFromInternet();
        return view;

    }

    private void getDataFromInternet() {
        new GetJsonFromUrlTask(getActivity(), url).execute();

    }

    private void setListViewAdapter() {
        books = new ArrayList<ListView_Model>();
        adapter = new CustomListViewAdapter(getActivity(), R.layout.item_listview, books);
        listview.setAdapter(adapter);
    }

    //parse response data after asynctask finished
    public void parseJsonResponse(String result) {
        Log.i(TAG, result);
        try {
            JSONObject json = new JSONObject(result);

            JSONArray jArray = new JSONArray(json.getString("customer"));

            for (int i = 0; i < jArray.length(); i++) {

                JSONObject jObject = jArray.getJSONObject(i);

                ListView_Model book = new ListView_Model();
                book.setName(jObject.getString("name"));
                book.setAuthorName(jObject.getString("email"));
                book.setPhoneNo(jObject.getString("phone_no"));


                /*Pay Button here*/
                book.setImageUrl1(R.drawable.custom_button);

                books.add(book);
            }

            adapter.notifyDataSetChanged();
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }}

**GetJsonFromUrlTask class:**

    public class GetJsonFromUrlTask extends AsyncTask<Void, Void, String> {

    private Activity activity;
    private String url;
    private ProgressDialog dialog;
    private final static String TAG = GetJsonFromUrlTask.class.getSimpleName();

    public GetJsonFromUrlTask(Activity activity, String url) {
        super();
        this.activity = activity;
        this.url = url;
    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        // Create a progress dialog
        dialog = new ProgressDialog(activity);
        // Set progress dialog title
        dialog.setTitle("Loading Datas....");
        // Set progress dialog message
        dialog.setMessage("Please wait!!");
        dialog.setIndeterminate(false);
        // Show progress dialog
        dialog.show();
    }

    @Override
    protected String doInBackground(Void... params) {

        // call load JSON from url method
        return loadJSON(this.url).toString();
    }

    @Override
    protected void onPostExecute(String result) {
        ((ListClassFragment) activity).parseJsonResponse(result);
        dialog.dismiss();
        Log.i(TAG, result);
    }

    public JSONObject loadJSON(String url) {
        // Creating JSON Parser instance
        JSONGetter jParser = new JSONGetter();

        // getting JSON string from URL
        JSONObject json = jParser.getJSONFromUrl(url);

        return json;
    }

    private class JSONGetter {

        private InputStream is = null;
        private JSONObject jObj = null;
        private String json = "";

        // constructor
        public JSONGetter() {

        }

        public JSONObject getJSONFromUrl(String url) {

            // Making HTTP request
            try {
                // defaultHttpClient
                DefaultHttpClient httpClient = new DefaultHttpClient();
                HttpPost httpPost = new HttpPost(url);

                HttpResponse httpResponse = httpClient.execute(httpPost);
                HttpEntity httpEntity = httpResponse.getEntity();
                is = httpEntity.getContent();

            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            } catch (ClientProtocolException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }

            try {
                BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"),
                        8);
                StringBuilder sb = new StringBuilder();
                String line = null;
                while ((line = reader.readLine()) != null) {
                    sb.append(line + "\n");
                }
                is.close();
                json = sb.toString();
            } catch (Exception e) {
                Log.e("Buffer Error", "Error converting result " + e.toString());
            }

            // try parse the string to a JSON object
            try {
                jObj = new JSONObject(json);
            } catch (JSONException e) {
                Log.e("JSON Parser", "Error parsing data " + e.toString());
            }

            // return JSON String
            return jObj;

        }
    }}

**Error :  incompatible types: Activity cannot be converted to ListClassFragment**

I don't know how to solve this issue, please can anyone help me here?.


    