Search Results

Search found 242 results on 10 pages for 'spinner'.

Page 1/10 | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • How to display data in spinner from json

    - by user1605913
    I am retrieving values from a json url and then storing it in a string variable. Now I want to display that value in a spinner. I have created an array list in my strings.xml file. The xml file contains following code: <string name="credit_card_title">Card Type</string> <string-array name="credit_card"> <item >Select</item> <item >Visa</item> <item >MC</item> <item >Amex</item> <item >Discover</item> my spinner code is: <Spinner android:id="@+id/crdtcrd_crdtype" android:layout_width="match_parent" android:layout_height="wrap_content" android:entries="@array/credit_card" android:prompt="@string/credit_card_title" /> After retriving the value from the json url I am storing it in variable name String cardtype Now how can I display the value of cardtype in the Spinner crtdcrd_crdtype.... the json url is: http://mygogolfteetime.com/iphone/login/[email protected]/123456 From this URL I have to retrieve the value of cardtype and after retrieving the value i have to display it in the spinner.. There are different values for cardype like visa, mc, amex and discover All these values are in my strings.xml file and after retrieving the value I have to display it in Spinner.. Help needed still not able to find the solution.. Thanks in advance...

    Read the article

  • Setting the position within a spinner

    - by eric
    Good Afternoon, I have a spinner array containing 3 spinners. Each spinner is populated via a res string array. Each array contains the numbers 1-100. When the activity starts each spinner contains a string array of 1-100 and when you click on a spinner the first choice is 1. Say a user picks 25 on the first spinner. I'd like the 2nd spinner to show 25 as the starting point for scrolling when the spinner is clicked but not fire the spinner. The 2nd spinner would still contain the array 1-100 though so a user could scroll down to a lessor number if the wanted to. I've tried using setSelection but that causes the 2nd spinner to fire causing undesirable effects (an edit box is populated with the 2nd number even though the user hasn't clicked the 2nd spinner). I would like the 2nd spinner to just show 25 as the starting point. How do I do this?

    Read the article

  • How to make Spinner Editable in Android?

    - by Dhrumil Shah
    I changed the ArrayAdapter method of spinner and i got my custom Spinner. just change the parameter of this method like Spinner spinner = (Spinner) findViewById(R.id.Spinner01); ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(This,R.array.statename,R.layout.mylayout); spinner.setAdapter(adp); In Which the mylayout file contains <EditText android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/spinnerTarget" android:textColor="#FF8B1500" android:gravity="center" >

    Read the article

  • Android: How to keep onItemSelected from firing off on a newly instantiated Spinner

    - by Drennen
    I've thought of some less than elegant ways to solve this, but I know I must be missing something. My onItemSelected fires off immediately without any interaction with the user, and this is undesired behavior. I wish for the UI to wait until the user selects something before it does anything. I even tried setting up the listener in the onResume, hoping that would help, but it doesn't. How can I stop this from firing off before the user can touch the control? THANKS public class CMSHome extends Activity { private Spinner spinner; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Heres my spinner /////////////////////////////////////////// spinner = (Spinner) findViewById(R.id.spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( this, R.array.pm_list, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); }; public void onResume() { super.onResume(); spinner.setOnItemSelectedListener(new MyOnItemSelectedListener()); } public class MyOnItemSelectedListener implements OnItemSelectedListener { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { Intent i = new Intent(CMSHome.this, ListProjects.class); i.putExtra("bEmpID", parent.getItemAtPosition(pos).toString()); startActivity(i); Toast.makeText(parent.getContext(), "The pm is " + parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show(); } public void onNothingSelected(AdapterView parent) { // Do nothing. } } }

    Read the article

  • How to grey out spinner in Android?

    - by Janusz
    I use two Spinner in my App. One of them is initially disabled because I need the user to select something in the first spinner to load the content of the second one. I would like to change the design of the second spinner to show the user that the spinner is not active, eg. grey the spinner out. How can I achieve this? If this is not possible how would you change this dialog to make it clear to the user that she has to select something in the first spinner?

    Read the article

  • setSelection on Spinner based on rowId

    - by awiden
    Hi! I have a Spinner View that's populated through a SimpleCursorAdapter. Based on the selection I need to save the rowid in the entry database (position won't work because things can be added and deleted from the Spinner Database). This I can do by using spinner.getAdapter().getItemId(pos) . But When I edit an entry I need to make the Spinner position selected that is associated with this rowid (currently). spinner.setSelection(position) won't work because I have the rowid, I need a way to find the current position of the item in the current spinner based on the rowid in the database.

    Read the article

  • layout messed up once spinner has entries

    - by AndyAndroid
    Hello, I have <LinearLayout android:id="@+id/LinearLayoutPlayer" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <Spinner android:id="@+id/Spinner01" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="100"></Spinner> <ToggleButton android:text="@+id/ToggleButton01" android:id="@+id/ToggleButton01" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1"></ToggleButton> </LinearLayout> Which displays a spinner and next to it a toggle button. Everything okay so far. Of course the spinner need some entries, so I add to the spinner the attribute: android:entries="@array/myentries" The problem now is that the toggle button is a bit lower than the spinner and the botton of the toggle button is cut off, maybe 3 or 5 lines of pixels. Anyone an idea what is wrong here? Android is version 2.2 Thanks!

    Read the article

  • My Spinner Widgets look different on different devices. How can I define a own Spinner that looks th

    - by Janusz
    I use this code to generate a spinner in my app: subCatAdapter = new ArrayAdapter<Subcategory>(this, android.R.layout.simple_spinner_item, subCategories); subCatAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 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.

    Read the article

  • Android: Create spinner programmatically from array

    - by Select0r
    Hi, I'm all new to Android and I'm trying to create a spinner programmatically and feeding it with data from an array, but Eclipse gives me a warning that I can't handle. Here's what I got: This ArrayList holds the elements that should be in the spinner (gets filled from a file later on): ArrayList<String> spinnerArray = new ArrayList<String>(); This is code I found on a site which should create the spinner: Spinner spinner = new Spinner(this); ArrayAdapter spinnerArrayAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, spinnerArray); spinner.setAdapter(spinnerArrayAdapter); Now the second line (ArrayAdapter...) gives me a warning in Eclipse saying "ArrayAdapter is a raw type... References to generic type ArrayAdapter<T> should be parameterized", I have no idea how to fix this (or what that means in the first place :) ). It's just a warning and the App seems to run alright, but I'd still like to understand what's wrong and fix it. Any hint is appreciated. Greetings, Select0r

    Read the article

  • Spinner original text

    - by user1696863
    I'm trying my Spinner to display "Select City" before the Spinner has itself been clicked by the user. How can I do this? My current XML code is: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res/com.olacabs.customer" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/page_background" android:orientation="vertical" > <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:color/darker_gray" android:gravity="center" android:paddingBottom="4dp" android:paddingTop="4dp" android:text="@string/rate_card" android:textColor="@color/white" android:textSize="20dp" custom:customFont="litera_bold.ttf" /> <Spinner android:id="@+id/select_city" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="40dp" android:prompt="@string/selectCity" /> </LinearLayout> Also, what does android:spinnerMode exactly do. I tried changing its value to dropdown but nothing happened and the application still showed a popup dialogue. My activity that implements this XML file is: public class RateCardActivity extends OlaActivity { public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.rate_card); Spinner spinner = (Spinner) findViewById(R.id.select_city); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.select_city, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); } }

    Read the article

  • here is my code for spinner with dropdownlist:

    - by user555910
    I have spinner in my application .The spinner have drop down list.I want to take the value of the dropdown list from the database .how can i do this ? here is my code for spinner with dropdownlist: ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, selectdefault); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter);

    Read the article

  • Android Bind Spinner to Class

    - by drbob
    I'm having some trouble with the Spinner widget. Given the following code: ArrayList<Person> people= new ArrayList<Person>(); Person = null; for(int i = 0; i!= 10; i++) { p = new Person(); s.setID(i); s.setName("Name " + i); people.add(s); } I'm using the following code to bind it to a Spinner: Spinner spinner1 = (Spinner) findViewById (R.id.spinner); ArrayAdapter<Person> adapter = new ArrayAdapter<Person>(this, android.R.layout.simple_spinner_item, people); spinner1.setAdapter(adapter); What I would like is for the value (id) to be hidden but passed when selected, and the name to appear. Any help is appreciated. Thanks.

    Read the article

  • Setting values and display Text in Android Spinner

    - by kaibuki
    Hi, I need help in setting up value and display text in spinner. as per now I am populating my spinner by array adapter e.g mySpinner.setAdapter(myAdapter); and as far as I know after doing this the display text and the value of spinner at same position is same. The other attribute that I can get from spinner is the position on the item. now in my case I want to make spinner like the drop down box, which we have in .NET. which holds a text and value. where as text is displayed and value is at back end. so if I change drop down box , I can either use its selected text or value. but its not happening in android spinner case. For Example: Text Value Cat 10 Mountain 5 Stone 9 Fish 14 River 13 Loin 17 so from above array I am only displaying non-living objects text, and what i want is that when user select them I get there value i.e. like when Mountain selected i get 5 I hope this example made my question a bit more clear... thankx

    Read the article

  • Spinner activity not working

    - by user1696863
    I'm trying to create an activity, RateCardActivity, which has a spinner in it. My layout file for RateCardActivity is rate_card. My RateCardActivity looks like the following. public class RateCardActivity { public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.rate_card); Spinner spinner = (Spinner) findViewById(R.id.select_city); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.select_city, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); } } The layout file rate_card is: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res/com.olacabs.customer" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:color/darker_gray" android:gravity="center" android:paddingBottom="4dp" android:paddingTop="4dp" android:text="@string/rate_card" android:textColor="@color/white" android:textSize="20dp" custom:customFont="litera_bold.ttf" /> <Spinner android:id="@+id/select_city" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> The RateCardActivity is called from another activity using an intent (I'm sure there is nothing wrong with that part of the code as when I substitute RateCardActivity with another activity, the application works fine). When I try to open the RateCardActivity in the application in emulator, the application crashes and I got the message "The application has stopped unexpectedly. Please try again later." I can't seem to understand what I'm doing wrong, and want to know how to correct this?

    Read the article

  • Android :WindowManager$BadTockenException on Spinner Click

    - by Miya
    Hi, I have a spinner in my home.class. When I click on the spinner, the process is stopped showing exception that WindowManager$BadTockenException is caught. I am calling this home.class from main.class which extends ActivityGroup. If I am simply run only the home.class, the spinner is showing all items. But the problem is only with calling home.class from main.class. The following are my code. Please tell me why this is happened. main.class public class main extends ActivityGroup { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent=new Intent(this,home.class); View view=getLocalActivityManager().startActivity("1", intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView(); setContentView(view); } } home.class String[] country={"Please selects","US","INDIA","UK"}; Spinner s2 = (Spinner) findViewById(R.id.spinnerCountry); ArrayAdapter<CharSequence> adapterCountry=new ArrayAdapter(this,android.R.layout.simple_spinner_item,country); adapterCountry.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); s2.setAdapter(adapterCountry); s2.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected( AdapterView<?> parent, View view, int position, long id) { countryName=country[position]; } public void onNothingSelected(AdapterView<?> parent) { countryName=country[0]; } }); Stack Thread [<1 main] (Suspended (exception WindowManager$BadTokenException)) AlertDialog(Dialog).show() line: 245 AlertDialog$Builder.show() line: 802 Spinner.performClick() line: 260 View$PerformClick.run() line: 9080 ViewRoot(Handler).handleCallback(Message) line: 587 ViewRoot(Handler).dispatchMessage(Message) line: 92 Looper.loop() line: 123 ActivityThread.main(String[]) line: 3647 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 507 ZygoteInit$MethodAndArgsCaller.run() line: 839 ZygoteInit.main(String[]) line: 597 NativeStart.main(String[]) line: not available [native method] Thank You....

    Read the article

  • Get item from spinner into url

    - by ShadowCrowe
    I searched for an answer but couldn't find it. The problem: Depending on the selected spinner-item the application should show a different image. At this moment I can't get it to work. The Url works like this: "my.site.com/images/" imc_met ".png" were imc_met is the filename. I can't get it to work. Btw the app isn't finished yet package example.myapplication; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.Spinner; public class itemsActivity extends Activity { private Spinner spinner1, spinner2; private Button btnSubmit; private Bitmap image; private ImageView imageView; private String imc_met, imc; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.items); addItemsOnSpinner2(); addListenerOnButton(); addListenerOnSpinnerItemSelection(); } // add items into spinner dynamically public void addItemsOnSpinner2() { spinner2 = (Spinner) findViewById(R.id.spinner2); List<String> list = new ArrayList<String>(); list.add("list 1"); list.add("list 2"); list.add("list 3"); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner2.setAdapter(dataAdapter); } public void addListenerOnSpinnerItemSelection() { spinner1 = (Spinner) findViewById(R.id.spinner1); spinner1.setOnItemSelectedListener(new CustomOnItemSelectedListener()); } // get the selected dropdown list value public void addListenerOnButton() { spinner1 = (Spinner) findViewById(R.id.spinner1); spinner2 = (Spinner) findViewById(R.id.spinner2); btnSubmit = (Button) findViewById(R.id.btnSubmit); spinner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { if(spinner1.getSelectedItem()!=null){ imc_met = spinner1.getSelectedItem().toString(); } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); imageView = (ImageView)findViewById(R.id.ImageView01); btnSubmit.setOnClickListener(new OnClickListener() { public void onClick(View v) { URL url = null; try { url = new URL("my.site.com"); //here should the right link appear. } catch (MalformedURLException e) { e.printStackTrace(); } try { if (url != null) { image = BitmapFactory.decodeStream(url.openStream()); } } catch (IOException e) { e.printStackTrace(); } imageView.setImageBitmap(image); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }

    Read the article

  • Android Spinner selection

    - by Arutha
    The OnItemSelectedListener event handler gets called both when a spinner selection is changed programmatically, and when a user physically clicks the spinner control. Is is possible to determine if an event was triggered by a user selection somehow? Or is there another way to handle spinner user selections?

    Read the article

  • how to implement add item in spinner array adapter in android

    - by narasimha
    hi folks, i had a EditText , a button and a spinner . When click the button , the spinner will add a new item with name you entered in the EditText. But here is the question, my adapter.add() method seems doesn't work...here is my code: bt1 = (Button)this.findViewById(R.id.AddBtn); et = (EditText)this.findViewById(R.id.newSpinnerItemText); spinner = (Spinner)this.findViewById(R.id.dynamicSpinner); adapter = ArrayAdapter.createFromResource( this, R.array.simple_from_length, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); bt1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String temp = et.getText().toString(); adapter.add(temp); // adapter.notifyDataSetChanged(); spinner.setAdapter(adapter); } }); error of this file: 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): java.lang.UnsupportedOperationException 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at java.util.AbstractList.add(AbstractList.java:410) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at java.util.AbstractList.add(AbstractList.java:432) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.widget.ArrayAdapter.add(ArrayAdapter.java:178) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at org.example.SpinnerKiran.SpinnerKiran$1.onClick(SpinnerKiran.java:56) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.view.View.performClick(View.java:2179) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.view.View.onTouchEvent(View.java:3828) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.widget.TextView.onTouchEvent(TextView.java:6291) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.view.View.dispatchTouchEvent(View.java:3368) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1707) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1197) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.app.Activity.dispatchTouchEvent(Activity.java:1993) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1691) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.view.ViewRoot.handleMessage(ViewRoot.java:1525) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.os.Handler.dispatchMessage(Handler.java:99) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.os.Looper.loop(Looper.java:123) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at android.app.ActivityThread.main(ActivityThread.java:3948) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at java.lang.reflect.Method.invokeNative(Native Method) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at java.lang.reflect.Method.invoke(Method.java:521) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 02-27 18:01:17.728: ERROR/AndroidRuntime(1982): at dalvik.system.NativeStart.main(Native Method)

    Read the article

  • How can I use spinner setOnItemLongClickListener

    - by elCarda
    Hi, I am trying to make the Spinner behave different way when the user clicked on an item for a long time. I have spinner with some project and I want two things. When the user simple click on an item I want to normal select it. When the user have long clicked on an item I want to show dialog, with options like "Edit item", "Delete item". The first step works well (ofcourse), but when I am trying to do the second task I can not make spinner to generate longClicked event. Here is my code: this.projectSpinner = (Spinner) this.findViewById(R.id.SpinnerProjects); this.projectSpinner.setLongClickable(true); this.projectSpinner.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener(){ public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Toast.makeText( AndroidTimeTrackerMainActivity.this, "Long click", Toast.LENGTH_SHORT).show(); // This toast doesn't show up. return false; } });

    Read the article

  • Sciptaculous number spinner

    - by xain
    Hi, does anybody know of the existence of a number spinner component compatible with prototype/scriptaculous ? Something like jquery's spinner (http://docs.jquery.com/UI/Spinner). I'm looking for nothing fancy, just numbers. Thanks!

    Read the article

  • Andriod Spinner not displaying list items.

    - by user300339
    I think I am going crazy right now. I am trying to create a spinner populated by a datatable but for some reason the dropdown list items text is not being displayed. I have looked all over and have seen other posts with people having this same problem. Can anyone help?? speciesList = (Spinner) findViewById(R.id.speciesList); spinnerCursor = nsfdb.fetchAllSpecies(); startManagingCursor(spinnerCursor); //String []cArrayList = new String[]{"dog", "cat", "horse", "other"}; String[] from = new String[]{"species"}; int[] to = new int[]{R.id.text1}; SimpleCursorAdapter locations = new SimpleCursorAdapter(this, R.layout.loc_row, spinnerCursor, from, to); locations.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); speciesList.setAdapter(locations); The spinner gets created just fine and is populated with 4 items but whenever I click on the spinner I see 4 items with no text and just radiobuttons. If I select any of them I am getting the correct selected item value but there is just no data displayed.

    Read the article

  • android spinner width problem?

    - by UMMA
    dear friends, i have created following layout. <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TableRow> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Post As" /> <Spinner android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/ddlPostAs" /> </TableRow> <TableRow> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Expires In" /> <Spinner android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/ddlExpiryOn" /> </TableRow> </TableLayout> in which android spinner changes its width according to the data. i want to stop it. can any one guide me how to achieve this? any help would be appriciated.

    Read the article

  • How to customise the TextView inside a Spinner?

    - by Janusz
    I have a Spinner with an ArrayAdapter that feeds Values into it. The Problem is that the text is to long for the view and the result is a very very ugly spinner. As can be seen in the screenshot: I tried to pass the Id of my own TextView into the Adapter but everytime the spinner should be shown I get an Exception that the Id I supplied is not valid: 04-26 17:38:39.695: ERROR/AndroidRuntime(4276): android.content.res.Resources$NotFoundException: Resource ID #0x7f09003a type #0x12 is not valid Where do I have to define the TextView? In a separate xml file? With a surrounding viewgroup? It would help me a lot if I could see an example of the adapter initialization and the textview definition?

    Read the article

  • Using 'ref code' related to the spinner option chosen

    - by user1508541
    I am trying to add a spinner function in a trial app which compares the frequency charts of earphones. I am trying to extract the info from " http://www.headphone.com/learning-center/build-a-graph.php " website. what I want to do is make the spinner work like the drop down list in the mentioned website. On further inspection what I found was that every dropdown element is provided with a unique code that is called when the particular element is selected. I need help in replicating the same in an android spinner.

    Read the article

1 2 3 4 5 6 7 8 9 10  | Next Page >