as indicated in the title I want the spinner to proceed in the next item upon clicking the OK button.
BTW the spinner items was fetched in mysql Database.
For example I have these items
"Jeffrey Oliveras"
"Wendy Lixardo"
"Mc Salinas"
and the first selection is " Jeffrey Oliveras" then upon clicking the okay button it will automatically proceed to "Wendy Lizardo"
any help will be appreciated.
Use this code in your Button Onclicklistener
if(spinner.getSelectedItemPosition() < spinner.getAdapter().getCount()){
spinner.setSelection(spinner.getSelectedItemPosition()+1);
}
Hope it work.
Related
I've been looking for the answer on the Internet, but could not find it. help me please.
How to make pressing the list item in Calabash-Android?
Try this out
Add a definition to ruby step file.
Then /^I scroll to cell with "([^\"]*)" label and touch it$/ do |name|
element="TextView text:'#{name}'"
if !element_exists(element)
wait_poll(:until_exists => "TextView text:'#{name}'", :timeout => WAIT_TIMEOUT) do
performAction('scroll_down')
end
if element_exists(element)
touch(element)
sleep(STEP_PAUSE)
else
screenshot_and_raise "could not find the cell"
end
else
touch(element)
sleep(STEP_PAUSE)
end
end
and call it from feature file Then I scroll to cell with "cellMainLabel" label and touch it
The answer above looks a bit more fool proof than mine but I have been using the following quite happily:
spinner selection
Then (/^I select spinner by id "(.*?)"$/) do |spinnerid|
touch("spinner id:'#{spinnerid}'")
end
select an item in the damn spinner
Then (/^I touch "(.*?)"$/) do |text|
touch("TextView text:'#{text}'")
end
it's two steps, first part will select the spinner via its id and then the second part selects the item in the spinner via the text you quoted.
i'm newbie to android program..I find some error in my final project tour travel app...i want to make listview that contain hotel list, then if listview was clicked will show detail hotel..ok..it works..
On detail hotel page there is a button "CEK KAMAR", it's used to show listview of room hotel based on ID hotel..i got stuck on this part..the listview has showed but all room class of all hotels..i can't filter the listview based on ID hotel..so..i really need help...thanks advance..
For more clear explanation, hereby i enclosed the screenshot app..
i have a main page with 2 buttons 'save' & 'search'. when 'save' button is clicked it would open the layout 'DATA' for inserting data such as name, country, city, category, comment. OnClickSave the data would be saved. when the 'search' button is clicked it would open the layout countries.the layout would display data key in countries than selecting from the list it would open the city layout that is save under the country and so on. how do i do so??
I will just write steps here.
Main activity:
On Save button Click : Open a new activity with form. Save the data to database.
On Search button Click: You can open a new activity with listview in it. That listview can contain every country inside database table. On click, you can go to other activity which will fetch the country details, and display them.
If you have any doubt, then please ask.
I am developping an app that has some quotes but I am unable to have next/previous buttons to navigate between the quotes like in the attached image ??
can anybody help ?
http://img.technospot.net/Free-Android-app-Success-Quotes.jpg
If the only that that's changing is the quote, just have the next and previous buttons change the text on click to the next quote in the cycle.
I'm assuming you are genarating randoms numbers to show the quotes randomly. Just save the position of the quotes(are they stored in an array?) and save them in an Integers List every time the user clicks next.
List<Integer> intList = new ArrayList<Integer>();
So if the user wants to go back just get the previous number which was shown by accessing the list with :
intList.get(intList.size()-1);
You should provide more informations next time and be as precise as you can.
in my app i have a spinner and a button below it when i run the program suppose this page is open which contains spinner and a button ,when i dont select any item from spineer it takes first values of spinner by default i want if nothing is selected it contains null value ..... how to do this??? thankss a lot my code is..
HI Saurabh,
I would suggest you to give your first spinner value as "--Select--" or some message. And try to validate in your code, by checking return value of the spinner which should not be the first manual value that you given into the spinner.
You can refer this page
http://developer.android.com/resources/tutorials/views/hello-spinner.html
the parameter "position" records your selected item.so you can use this parameter.