Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>with the code you posted there doesn't seem to have anything that would be taking an awful a lot of time. </p> <p>I don't believe making an endless list (either using the endless adapter or manually) is the case for you because apparently the web-server you're communicating with does not have the options for page (e.g. when on the URL you specific items per page and page number like this: <code>?per_page=20&amp;page_no=1</code>) and those type of list only makes sense for such.</p> <p>Just as a simple test, put those lines before after your code:</p> <pre><code>long now = System.currentTimeMillis(); JSONObject json = jParser.makeHttpRequest(url_all_ads, "POST", params); Log.d("Test", "Elapsed time is: " + Long.toString(System.currentTimeMillis() - now)); </code></pre> <p>then you can check on your LogCat how long did it took to make the http request.</p> <p><strong>edit:</strong></p> <p>suggested alternative to HashMap&lt;> as I don't believe they are very efficient ways of storing data.</p> <pre><code>public class MyData(){ JSONObject data; public MyData(JSONObject data){ this.data=data; } public String getId(){ return data.getString("rowid"); } // repeat for the other info you need, also override the toString to return the data.toString(); } </code></pre> <p>that way all the JSON parsing will be done at a later point in time and in small batches and your for loop would be as simple as:</p> <pre><code> for (int i = 0; i &lt; dataJsonArray.length(); i++) { productList.add(new MyData(dataJsonArray.getJSONObject(i)); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload