Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Android Pagination, Titlebar, footer

 
UdayK Kumar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have several questions. Can anyone help me.

1) How to do pagination in android. Actually I want to show 1000 rows in a view. Insted putting into scrollbar, Can I show 10 rows per page and next.. next move to 10 pages. how to achive this problem?


2) How to add custom titlebar which contain label and button for TABHOST.

3) I have a 4 buttons for footer. How to write common code for these buttons for all activities.


Thanks for your help.
 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about this. Have a single layout with header, 10 data rows, a footer for the buttons. Initially, place the first 10 items in the data rows. When the user swipes to the left or right, replace the 10 data items with the next (or previous) 10 data items.
 
zoheb hassan
Ranch Hand
Posts: 154
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey peter, what classes might be required for the user swipe and replacing the 10 rows,I mean will the data be loaded directly from the database or is there any other way of doing it.

-Zoheb
 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Activity.onTouch() and look for a MotionEvent.ACTION_MOVE. By tracking the coordinates of the even you can tell if the user is moving his finger to the left or to the right.

You can keep the data in any class you want. If you have little data, it is usually easier to keep it in memory. If you have a lot of data, or the potential for a lot of data, then reading it from the database is usually best. You usually want to buffer some data, though. For example, you might want to read the first 50 or 100 items, that way the paging back and forth will go smoother.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic