Below is my code and I get the data from the webservice(remote server) in the doinbackground(). I want to set the data on the UI. Everything works fine. But as I have huge amount of data to be retrieved from the server, the progress bar is showing for a long time. So, I decided to use something like CW endlesss adapter or according to this. It's been giving me grief for few days by now.
1) CW endless adapter: I face a lot of problems in including it as a library project and when I try to run demos, it always shows me ! symbol in red color. When I click on run, it says your project has errors, but there is not even a single clue where does that error occur. Even I am unable to understand the things that have to be done too as those are somewhat difficult for me as a beginner. So, I decided to follow as per the other.
2) In this, I am unable to get on how to use this in my scenario as I am getting the data as a whole after completion of the doInBackground().
Can someone help me on this with relevant code snippets? I would be very thankful for your help.
I am calling this asynctask in onCreate() method.
class LoadAllData extends AsyncTask<String, String, String> {
    /**
     * Before starting background thread Show Progress Dialog
     * */
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(GetData.this);
        pDialog.setMessage("Loading Data. Please wait...");
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(false);
        pDialog.show();
    }
    /**
     * getting All Data from url
     * */
    protected String doInBackground(String... args) {
        // Building Parameters
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair("datatobefetched", datadetails));
        // getting JSON string from URL
        JSONObject json = jParser.makeHttpRequest(url_all_ads, "POST", params);
        Log.d("All Products: ", json.toString());
        try {
            // Checking for SUCCESS TAG
            int check = json.getInt(CHECK);
            if (Check == 1) {
                // Data found
                // Getting Array of Data
                dataJsonArray = json.getJSONArray("totaldata");
                // looping through All data
                for (int i = 0; i < dataJsonArray.length(); i++) {
                    JSONObject jobj = dataJsonArray.getJSONObject(i);
                    // Storing each json item in variable
                    String id = jobj.getString("rowid");
                    String product = jobj.getString("data1");
                    String review = c.getString("data2");
                    String imagepath = c.getString("image_url");
                    // creating new HashMap
                    HashMap<String, String> map = new HashMap<String, String>();
                    // adding each child node to HashMap key => value
                    map.put("id", id);
                    map.put("product", product);
                    map.put("review", review);
                    map.put("imageurl", imagepath);     
                    // adding map to ArrayList
                    productsList.add(map); // ProductList is arrayList.
                }
            }
            else {
                // no data found
            }
        } 
        catch (JSONException e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * After completing background task Dismissing the progress dialog
     * **/
    protected void onPostExecute(String file_url) {
        // dismiss the dialog after getting all products
        pDialog.dismiss();
        // updating UI from Background Thread
        runOnUiThread(new Runnable() {
            public void run() {
                // Updating parsed JSON data into ListView
                // Getting adapter by passing xml data ArrayList
                ListView list = (ListView)findViewById(R.id.list);   
                adapter = new CustomListAdapter(GetAllAds.this, productsList, passedcategory);        
                list.setAdapter(adapter);
            }
        });
    }
}
 
     
    