In this code i am creating two drop downs and now my requirement is when i select the item from first combo the data in the second combo must be changed according to the selected item of first combo. now in onItemSelected property how to code specially for first dropdown?
My Activity implements OnItemSelected listener for a spinner. It has the interesting problem of firing off the onItemSelected callback when the activity shows. So I used a flag hack to solve it (I hate it, but at this point I just want the app to work).
Strangely enough, even though the callback gets called right at activity start, my actual touch selections don't work. I can touch the list, open it, see the strings from the array adapter, and even touch it to make it dismiss - but the callback is never called.
The toast is shown right when the activity is shown, but when I select items in the spinner, the spinner dismisses and no toast is displayed again (not to mention the rest of the code in the callback fails to execute).
I am having an Android view with a Spinner on it. I call a populateSpinner() method to add some default values to it.
I also have a onItemSelected() event which gets called before the view is completed to print. I would like to run a code inside this block only when the user changes the selected items, not when I add or the form gets created.
I am using a menu in my application Same as this post... I am using a gallery view for display my menu items
Text Gallery on Android?
Problem is that, i implement onItemSelected listener for gallery, so that when new item is selected data related to that topic loaded. But i also want to allow user to scroll the gallery fully. but each time when user move to next item onItemSelected() function called and it start loading data.
All i want to do is to put some delay in onItemSelected() function, so that if in between that delay user scroll next item than there is no need to load data of previous but for the current. Time may be 1 second. If user dose not go for next item in 1 second, that data of that item must be loaded.
I thought to start a thread,but each time for onItemSelected() there will be new thread...
1) I have a Spinner with several options provided by an ArrayAdapter and have an onItemSelected listener on this Spinner. When selecting an item from the spinner, I want to display another view (list-view) but this method is unintentionally invoked upon initially displaying the view. The list-view is therefore displayed upon startup of the application. It is possible to add a spinner-on-item-select listener that won't fire upon initially displaying the view but only by the user selecting an item?
I use this code to generate a spinner in my app: code:.........
On my device (Motorola Milestone) and in the emulator this looks like the standard gray spinner widget. On of my colleagues uses a Motorola Backflip and on his device the Spinner is black. Now its very hard to read the font in the spinner.
What do I have to do to use my own view for the spinner? I don't mind to have the gray spinner on all devices, but it should always look the same on all devices.
I have an xml layout file which contains a few widgets including a Spinner I want to display a list of strings in the spinner, the list is generated at runtime as a result of a function so it can not be in arrays.xml.
I have a spinner 'aperture' set up with a list of numbers, and a spinner 'mode' with two options. When a button is pushed I need a calculation to run using various inputs, including the current selection from 'aperture' and a value derived from 'mode'. How do I call the value of a spinner so I can use it in a calculation?
Also, how do I use the spinner 'mode's selection to set this other value before implimenting it in the calculation? To be more specific, if the spinner is set to Small then the value I use in the calculation is 0.015, whereas if Large is selected I need to use 0.028
My other inputs are EditText views, so right now I am set up like this:
That is not the actual equation, it is just a test to make sure everything connects properly. How would I call the value of spinner 'aperture' and the Small/Large spinner 'mode'
I have a spinner widget in my activity which lets users pick a list name.
Normally, the function of the spinner is to switch between lists but for a couple of instances, I swap out the selection change listener to perform a different function with the same list of options. Once the selection has been made, the old listener is restored and life goes on.
This is a bad and buggy arrangement. Instead, I would like to have a function that just takes a selection listener and some other parameters and shows a popup list that's populated by the same cursor (or and identical cursor) as the spinner, without using the spinner itself.
I am trying to populate a spinner depending on another spinner's selected item, my code is the following:
what is intriguing me is that the first spinner onitemselection works perfectly ( I can see the values in LogCat) then when I change selection of the 2nd spinner I am gettging an error on this line: String selected= (String) s2.getSelectedItem(); So the compiler gets insisde then onItemSelected function of the 2nd spinner but throws an Handler exceltion on s2.getSelectedItem()
I am trying to write an application with a list of items read in from a file. This item list and the fields that go with each item are fed into a DB. The item names are presented to the user as an auto- completing list. Once the list item is selected, I would like to get the value from the list and use it to query the database and display all the detail information.
The problem I am having is trapping the event using onItemSelectedListener and onItemSelected.
Below is what I am trying.
This doesn't compile, but it has the fewest syntax errors.
How to get an OnItemSelectedListener to work? and how I grab the value selected?
Is it possible to get Autocomplete or Something when i work with the eclipse form editor?I write a color in the strings.xml and then i want to select it by the propertys for the text color, but there is no autocomplete or something equal
Is there any way to apply an animation to a property of a view? currently, the only animation i am aware of is applying an animation to an entire view. i'm wondering if i can apply an animation to a property (i.e. layout_width for example)
Because Java uses object references and not objects themselves, what prevents me from using setTag() to tag a view with an entire object instead of an object's property? Is it just the attribute lookup time when trying to resolve one of the attributes after the getTag() call or is there any other specific thing I should be concerned about?
As for my specific problem, I am using a custom listview that has an imageview and a textview. Initially I bind the listview to a custom adapter to fetch some xml data and then use certain tags inside each item's xml to populate my listview. So the "entire object" I was referring to was the parsed version of the entire XML of an item...
I would like to have multiple property files checked in to my project that each define the same properties but for different environments. For instance, a development one and an operational one that each point to a different server.
I've been trying to create a color LinearLayout object (1) within another LinearLayout object (2), while having (1) not display beyond the bounds of (2) - in short, I wish to assign the equivalent of the CSS overflow:hidden property to LinearLayout (2) so that LinearLayout (1) doesn't bleed beyond the edges of (2). <LinearLayout> <!-- (2) --> <LinearLayout> <!-- (1) --> </LinearLayout> </LinearLayout> Is this possible within Android?
I have a tab host with two tabs. I want one of those tabs to be a search screen. The content for the tab is a ListActivity. I'm pulling the content from a web service. My problem is, when I execute the search a new intent is pushed onto the screen. I've used the android:launchMode="singleTop" property in my manifest for the search activity. What that seems to have done is, once the new intent is pushed on top of the TabActivity, every time I run the search it reuses that intent. But I want the already existing intent which is set as the tab's content to be the one it uses.
I use the following instrumentation testrunner command line to run JUnit tests on my project :
and it runs OK.
I am now trying to pass a property value argument to my instrumentation test runner, something equivalent to the eclipse vm argument -Dcom.myApplication.myProperty="String" The value ("String") of a property (com.myApplication.myProperty) must be defined in the command line. I tried to bend my command line to make this work, changing it for example into :
but didn't manage to make it work correctly. Is there a way to make this work ?
I would like to know if is there a way to call android:layout_gravity property from a java method. I didn't found any method in Android documentation to do it. This is the picture of the layout I want to implement: But in my situation, I need to do it through Java code, because I'll implement another layout views dinamically. To avoid merging xml layout with Java code, I would prefer make all layout using Java. Code...
I want to change layout without calling the onCreate method. i also define android:configChanges="orientation|keyboardHidden" in my activity and it is not calling the onCreate method but the layout not adjust appropriately on landscape mode.
my current layout look like as follows.
after change orientation as landscape it look like as follows:
I have a 7 inch tablet (Novo 7 Paladin) running ICS. Unfortunately, most apps just use the phone layout wich I assume is because the manufacturer set the android:screenSize property to "large" instead of "xlarge".
Is there a way to change this, so that Apps will use the "xlarge" screen layout?
While starting my application I get the following warning in Logcat:
04-09 10:28:17.830: WARN/WindowManager(52): Exception when adding starting window 04-09 10:28:17.830: WARN/WindowManager(52): android.view.InflateException: Binary XML file line #24: Error inflating class <unknown> 04-09 10:28:17.830: WARN/WindowManager(52): at android.view.LayoutInflater.createView(LayoutInflater.java:513) 04-09 10:28:17.830: WARN/WindowManager(52): at .....
Splash is the image that is shown in the splash screen. I have those four folders with for storing drawables in my app: /res/drawable-hdpi /res/drawable-ldpi /res/drawable-mdpi /res/drawable-nodpi
the splash image has its own version in the first three of them and is displayed properly. Removing the src property from the ImageView removes the image but not the exception. I'm a little bit lost with where to look for the cause of the exception. I even don't know if this is really an issue in this layout file etc. How would you go about finding the cause for this warning?
I use Java API "System.setProperty()" to set a system property. After invoke "System.setProperty()", API "System.getProperty()" can return the value just I set. However, when I use command "adb shell getprop" to verify, it shows that this property is not set at all. Do I wrongly understand API "System.setProperty()" ?
I am developing a small application with the help of spinner widget.Requirement is to display different toast messages when the spinner list items are selected.For e.g if the spinner items are Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday then on selecting Sunday item through the spinner ,toast message should display "Sunday Selected".Please guide me on how do this and if possible share code snippet.
I am very new to android. I want to use 2 spinners in my application, one shows the countries list, when any country is selected the other spinner should show the list of cities of that country. when city is selected some action is performed.please help me with some sample code.
I am trying to get a Spinner to work in Android. It displays fine and I can select any one of the options in the list. But how do I transfer that to a string?I would have thought in the code below that 'selected' would hold the selected string, but I get an 'Illegal modifier for the local class YourItemSelectedListener; only abstract or final is permitted' error on the 'YourItemSelectedListener'.What am I doing wrong?
I have a view with a spinner. The activity starts another acvitity with a popup where I add or delete values that the parent shows in the Spinner.
So, in onActivityResult() I refresh the content of the Spinner so that it reflects any additional or deleted values, by calling my fillSpinner() method.
The parameter to this method is the previously selected value:
When I open the Spinner, it contains the correct list (i.e. it was refreshed) and the correct value is selected. However, the Spinner control itself (in its closed state) does not show the selected value, but the first in the list.
When I step through the code in the debugger, the Spinner value is correct before and after I call setSelection() (and it is always called with the same correct id). However, since I cannot step out of the event, when I resume the execution after a short moment the value in the Spinner changes.
In other words, the spinner's displayed string is changed and is different from the selected item when I return from my popup activity.
The default drop down view of the spinner occupies the entire width of the screen. I tried to create a custom spinner which occupies only some portion of the width of the screen, but I'm unable to do. I want to see the objects behind the drop down. Here is what i tried, I changed the drop down view as,
adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item); instead of
In the layout.simple_spinner_dropdown_item.xml file I specified the width, but it still occupies the entire width. Can any one help. Is there any other view which is similar to spinner but I should be able to see the background objects like a alert dialog. Is it really possible?
I have a Spinner.Is there a way to display some hint text on it?It seems to default to the first item in its supplied array adapter.I want the user to make a choice, right now it seems like it would assume the 0th item is by default selected.
Is there a way to set a Spinner's selection to 'none' ? When my activity launches, it looks like a spinner will automatically select the 0th element in the spinner. I'd like to explicitly make the user choose a selection instead.