0

I am working on this project that I cant seem to get right. Basically the application makes a request to my PHP server and displays the data on a listView.

Due to the large amount of data I have on my server, and the length of time it takes to get all the data on my listview. I decided to implement an OnScrollListener on the android side, to determine if the last item is visible, then I load more data. This I achieved by selecting all the IDs of the data I want to load when the the initial request is made. The IDs are then sorted based on my requirements (time created, points, etc) after which the first five ids are used to select the initial data which is returned to the android app along with the IDs. Then when the last item is visible, i send the next five ids from the list to a function on php which returns data corresponding to the five IDs.

So far this approach works but it is still unsatisfactory due to the amount large amount of data that needs to be processed during the initial request.

I need help with an alternative technique to achieve my objective with minimal delays while performing the initial request or subsequent request.

Any help will be much appreciated.

1
  • please guys its non-constructive if you vote my question down without giving a reason for a vote down. if you have to vote down please leave at least a comment stating why its voted down. after all this is learning environment Commented Sep 24, 2014 at 2:52

1 Answer 1

2

From what I read in your question, you are loading all the data at the initial request?
I suggest you to did pagination in your server side so you can minimalize the number of data, and call the next portion/page of data only when you need to do it (in this case you can implement it in OnScrollListener)

For more details about pagination
- http://www.phpfreaks.com/tutorial/basic-pagination
- http://www.phpeasystep.com/phptu/29.html
- http://code.tutsplus.com/tutorials/how-to-paginate-data-with-php--net-2928

Sign up to request clarification or add additional context in comments.

6 Comments

what is paging and could you explain more?
@PrincewillObinnaIwuorie What PHP framework do you use? Paging is splitting your data (Query result) to certain pieces with some limit per pieces. For example if you have 1000 datas, you can split it to 10 pieces (100 data per pieces) and call it sequentially.
ohh i see. but would that work on dynamic data? this is because the data I return with each request varies based on the user
@PrincewillObinnaIwuorie yeah it will, you can make the query based on the user too and then do the pagination to the data.
cool. could you point me in the right direction for implementing it for a php server with an android client
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.