1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

android newby...need a little help with a development question


Last Updated:

  1. Hyperjetta

    Hyperjetta New Member This Topic's Starter

    Joined:
    Oct 19, 2009
    Messages:
    3
    Likes Received:
    0
    Im trying to fill a spinner with data from a table. That part works
    fine. What i cant figure out is how to use the selection made
    through the spinner.

    if i use :
    String someString = (String) classSpin.getSelectedItem().toString();

    whats returned is an object of some sort. Am i missing a step? Im new to
    both java and android so i hope this is something very obvious im
    missing.

    heres some of my code for the spinner:

    Cursor classCur = db.getClasses();
    startManagingCursor(classCur);

    from = new String[]{DBAdapterStats2.KEY_CLASS};
    to = new int[]{android.R.id.text1};

    SimpleCursorAdapter classAdapter = new SimpleCursorAdapter(this,
    android.R.layout.simple_spinner_item, classCur, from, to);
    classAdapter.setDropDownViewResource
    (android.R.layout.simple_spinner_dropdown_item);
    classSpin.setAdapter(classAdapter);

    basically, i just want to have whats displayed in the spinner returned as a string so that i can use it elsewhere in my database. any ideas on where ive gone wrong?
     

    Advertisement
  2. Hyperjetta

    Hyperjetta New Member This Topic's Starter

    Joined:
    Oct 19, 2009
    Messages:
    3
    Likes Received:
    0
    nevermind, got it.
     

Share This Page

Loading...