[Q] display 5 rows in the list view - Android Software Development

Hi
I am using list view to display data in the screen, i am getting data from web service and i displaying the data in the listview. Its working fine.
Now the problem is i want to implement paging in the list view. For that i need to display only 5 records in the list view and once click the next/prev button it has to display another set of 5 records
I want to know how can display only five rows in the list view. and how can display next set of records while we click one next or prev button
any idea????
Thanks
mindus

How are you adding the rows? With an adapter? Can't you just limit your adapter to 5 views at a time?

Hi
Can u tell me how to do that? Or if u have any examples please share it
Thanks
mindus

You have to build a custom class derived from BaseAdapter, then you're free to do whatever you need to in your custom implementation of methods, namely: getCount() which tells the ListView attached to your adapter how many views to request.

Related

converter program (finger friendly) need suggestions

Hi wanted to create my first program..
right now Im trying to make a unit converter that is finger friendly..
so far I've tested it and here is what I have so far..
any suggestions? regarding the buttons positions, the interface, etc?
thanks
Hi Providense,
Looks good so far.
Do you have a development schedule as to what it will convert?
Keep it up.
John
Provedence,
It seems that some people like to have a configuration facility.
So perhaps some suggestions:-
Favorites so that the list can be tailored to favorites for that person to save a more compact list of 'things to convert'
I would be happy to have any theme for now but cooks may prefer to add there own theme.
I have used this type of function with calculator type programs but they can become unweildy so one that is specific would be usefull.
Thanks
John
thanks Johny1fin
as of now these are the things i've done
Temperature:
degree Celsius
degree Fahreheit
degree Rankine
degree Reaumur
kelvin
Acceleration: (still doing it right now)
centigal
centimeter/square second
decigal
decimeter/square second
dekameter/square second
foot/square second
g-unit(G)
gal
galileo
gn
grav
hectometer/square second
inch/square second
kilometer/hour second
kilomter/square second
meter/square second
mile/hour minute
mile/hour second
mile/square second
milligal
millimeter/square second
still a long way to go. But the Acceleration should be done by today.
Then I'll add Area, Date/Time and etc
I like the idea of favorites. I'll see if i can implement that. Im still a beginner at programming. Using VB.net 2003 right now
oh by the way. Here's the main menu, where I will put all the buttons
providence said:
Hi wanted to create my first program..
right now Im trying to make a unit converter that is finger friendly..
so far I've tested it and here is what I have so far..
any suggestions? regarding the buttons positions, the interface, etc?
thanks
Click to expand...
Click to collapse
Providence,
It may be a limitation of the APIs but could the vertical scroll buttons be next to each other horizontally rather than vertically as this may produce larger buttons?
John
Look nice.. however, on the finger friendly issue, you may want to avoid the scroll list (on your first screenshot) and have another screen for the choice of (say) different temperature units. Something like, making a screen (of your second shot) for temperature units. If you get what i'm trying to say
thanks for the feedbacks i've changed how the scrolling works. Now im using a custom button for that.
Looking good providence
I am not sure if you like this idea, but I think it will be more useful if you can add:
- Currency converter
- Currency quick view (to view several currencies at once)
There is an example of a very nice and complete project with source code here:
http://www.codeproject.com/netcf/PocketCurrency.asp
Add option to have automatic currency update as well
[ x ] Update when connected to ActiveSync
[ x ] Automatic update every X hours
hi, well the main idea was to create a finger based Unit conversion program. To add Currency Converter would be a challenge for myself.
Since first of all, Currency changes daily, so there must be a way to update it. Secondly, im still learning how to program by self teaching myself on my free time.
By the way, Here's the latest screenshot of the program.
I fixed the buttons so its easier to use.
unfortunately, this will only work on PDAphones and not on smartphones. Since you'll need to use the touch screen as input method.
Here is an idea, as mentioned by one of the post above, instead of stacking your scroll button up and down, it may save you that more space if you were to stack them left and right.
From what it seems, the < and > , are buttons, which you use it to 'affect' your lists. If you were to (example) sandwish your list in between these two buttons, you would save like another 2 button height. Example.
Currently, you have the layout
Code:
. item1 <
. item2
. item3 >
. item4
if you can just do this (which is possible in VC, not sure about VB), instead
Code:
< .item1 >
.item2
So, instead of 4 item height, you are now only left with 2 items height.
ahh i see..
I tried doing it
< item 1 >
item 2
but i find it harder to navigate, since when you go back you have to drag your finger across the other side of the screen. And while doing that, you are blocking the item list with your finger.
I dont need to save space, i think i got everything in there..
by the way, here's the test i took
then again, if i put them on the sides, it makes easier for those who are left handed as well
The spaces you save, may able you to bloat up the keypad below.. from what it seems, now they are on the 'flat' side of it.
If you think the "left-list-right" is not very finger friendly, you can try the "list-left-right"? That is
.item1 < >
.item2
Hi thanks for the suggestions..
right now here is what i have, and will probably be the final change in the button positioning..
i got big fingers and I can use them without stylus.
Should have a pre-alpha version ready soon. As of now I've done temperatures and acceleration.
Will add more soon

Name Picker

Could anyone knock up a name picker ?
You maintain a list of names
You hit a button and one of those names is chosen at random
Perhaps presented in a fun way - with an element of suspense
Something like this on Palm
Couldn't find anything on WM
Couldn't get it to work on Excel using a formula
This was the Palm version but I think installing style tap just to accomplise this would be OTT
http://www.freewarepalm.com/utilities/namepicker.shtml
In excel:
create a list of names
1 James
2 Jill
3 Joan
4 Jake
5 Jim
Name the list NamesList for instance
create the following formula
=vlookup(MOD(ROUND(RAND()*10,0),5)+1,NamesList,2)
Note: the MOD(ROUND(RAND()*10,0),5)+1 calculates a number between 1 and 5. This would need to be adjusted for other lengths... Replace 5 with the number of possible choices, replace 10 with the number of number places needed (ie, for a double digit number of choices use 100)
Or even simpler is
=choose(MOD(ROUND(RAND()*10,0),5)+1,"James","Jim","Jake","Jill","Joan","John")
Are these the people you want to kill?
Surur
No - this is that list
1. Surur
lol
Surur
tekknogenius said:
In excel:
create a list of names
1 James
2 Jill
3 Joan
4 Jake
5 Jim
Name the list NamesList for instance
create the following formula
=vlookup(MOD(ROUND(RAND()*10,0),5)+1,NamesList,2)
Note: the MOD(ROUND(RAND()*10,0),5)+1 calculates a number between 1 and 5. This would need to be adjusted for other lengths... Replace 5 with the number of possible choices, replace 10 with the number of number places needed (ie, for a double digit number of choices use 100)
Or even simpler is
=choose(MOD(ROUND(RAND()*10,0),5)+1,"James","Jim","Jake","Jill","Joan","John")
Click to expand...
Click to collapse
Many Thanks - the last one works but is not very pretty. I could do with some sort of button to recalculate/ refresh, that will work on WM6 Excel ??????

listview click on row goes to next screen

Hi
I am working on android project. I have a list view screen where it displays various data fetched form web service. This list view has more than 150 rows. So i implemented pagination and its works fine (display 5 rows).
I am using simple adapter for this list view. Now i want on click on row it has to collect the data in that row and it should go to new screen. In the new screen click on back button it has to come back to the list view(old position: for eg the list view display 51 - 60 records, once i click on 56th row it has to go to new screen, when i click back button then list view has display 51 - 60 records not 1 - 10 records)
Any idea about this issue?
Thanks
mindus
How are you launching the next screen? startActivity()? Maybe try startActivityForResult()?
Hi
I am using startActivity.
I have the problem like that the list view screen has displayed 41 - 50 records. If i click on 45th record then it will show the next screen, and while clicking on the back button in the next screen then the listview screen shows the records form 1 - 10 records instead of 41- 50.
Can you please tell me how to rectify this problem?
Thanks
mindus
When you return from the activity started by the startActivity() call, the list activity will be reset by default and re-request data from the adapter. Use some means to store the state of your list, then when your activity returns, use whatever pagination scheme you have developed to signal the adapter to restore the page you were previously at. I don't know how you've implemented your adapter, so that's about all I can tell you right now.

[Q] Confused with coding for layout.

Hi there, long time lurker first time poster here!
Slowly getting into android but i really cant get my head around the layouts. I would love to be able to use the AbsoluteLayouts but that isn't a good idea anymore.
Basically after some work i have managed to get a gallery working at the top of the screen. I want my app to look like this in essence: Ok can't post outside links at the moment, fair enough. Think of the android market. Icons to the left and a bit of information for each app next to it and a buy button on the right.
However i have no idea where to start off. Since i have the gallery already i have no idea how i can add things underneath it without screwing anything up.
Can anyone help? Thanks in advance!
Sorry to bump but the issue has changed, I have built an app but would like like the text to be besides the icon. Any chance someone can help? Using a linear layout.
http://img263.imageshack.us/i/sellscreen.jpg/
RED_ said:
Sorry to bump but the issue has changed, I have built an app but would like like the text to be besides the icon. Any chance someone can help? Using a linear layout.
http://img263.imageshack.us/i/sellscreen.jpg/
Click to expand...
Click to collapse
Are you using a List View? Looks like one.
How do you build up your content for the list?
In my view the best solution for your problem would be:
- Use a ListView
- Build your own ListAdapter (drived from BaseAdapter for example)
The Adapter builds the view for each item (or recycles an already built up view, the ListView handles that).
The view for each item would be a horizontal oriented LinearLayout with two items (the image and the text) and the adapter fills the layout with the information of the current item.
For better layout handling I would define the layout for the items in an extra xml file and use the LayoutInflater-Service inside the Adapter (if a view has to be built).
Hope this helps and points into a helpful direction
Devmil
Thanks for replying, managed to find a solution in the end without using ListView. Thought about moving to a RelativeLayout as its more effcient but as my app is very small anyway in the end i've just gone and used nested LinearLayouts with a textview and imageview in each one.
Ridiculously simple when you look back on it.
I was actually going to use this tutorial which does what you explained i think: http://www.anddev.org/iconified_textlist_-_the_making_of-t97.html but it left me with a force close error so that went out the window.

[Q] How to display data in table!?

Hello Guys, I'm a newbie in app development so help me with this (simple) query.
I have an activity with 4 text box asking for user input (name, place, date, time) . Now how to combine these data into a table in another activity.
PS: I have included exit button in main activity. Is it ok or should I include exit option in action bar menu only? Also what is the java function to exit the app?
Sent from my Xperia Mini using Tapatalk 2
ariftwister said:
Hello Guys, I'm a newbie in app development so help me with this (simple) query.
I have an activity with 4 text box asking for user input (name, place, date, time) . Now how to combine these data into a table in another activity.
PS: I have included exit button in main activity. Is it ok or should I include exit option in action bar menu only? Also what is the java function to exit the app?
Click to expand...
Click to collapse
Hi,
You can easily get a Table with the TableLayout, where in each TableRow you would put two EditTexts. In Android you usually don't need to put an edit button in the layout unless you have a service running or so since there is the back button to easily exit. The Java code to exit would be calling this.finish() from the activity.
SimplicityApks said:
Hi,
You can easily get a Table with the TableLayout, where in each TableRow you would put two EditTexts. In Android you usually don't need to put an edit button in the layout unless you have a service running or so since there is the back button to easily exit. The Java code to exit would be calling this.finish() from the activity.
Click to expand...
Click to collapse
Thanks for your suggestion, but I want all the four editText in a single row. How to do it,? Or is there any detailed tutorial?
Sent from my Xperia Mini using Tapatalk 2
ariftwister said:
Thanks for your suggestion, but I want all the four editText in a single row. How to do it,? Or is there any detailed tutorial?
Click to expand...
Click to collapse
You can find a tutorial on the TableLayout here. But if you just want one row, it's easier to just use a LinearLayout with equal weights for each View. If you want to reuse this layout for another activity, put it in a Fragment!
SimplicityApks said:
You can find a tutorial on the TableLayout here. But if you just want one row, it's easier to just use a LinearLayout with equal weights for each View. If you want to reuse this layout for another activity, put it in a Fragment!
Click to expand...
Click to collapse
Thanks but Actually I'm building an app to keep track all the user's debt. So I want to display the debts in a tabular view. It can be single or multiple varying with every user. So what should I use here?
Also how to place the data got from 4 different edittext as single object into another activity?
Sent from my Xperia Mini using Tapatalk 2
ariftwister said:
Thanks but actually I'm building an app to keep track all the user's debt. So I want to display the debts in a tabular view. It can be single or multiple varying with every user. So what should I use here?
Also how to place the data got from 4 different edittext as single object into another activity?
Click to expand...
Click to collapse
You may want to have a look at the samples of the TableFixHeaders library here to do your Layout. Remember putting it in a separate Fragment in case you want to reuse in another activity.
For data passing you need to put it as extra into the Intent you're starting the second activity with. The data structure you use depends on what you want to do. I recommend dropping everything into a new Bundle and pass that on, that way you can also save/restore when rotating. But if you have only the same data like 4 Strings or 4 doubles you could also directly put it as an array extra with intent.putDoubleArrayExtra or putStringArrayExtra

Categories

Resources