Results 1 to 3 of 3

Thread: drop down list

  1. #1
    nour is offline Member
    Join Date
    Oct 2011
    Posts
    12
    Rep Power
    0

    Default drop down list

    hi all
    iam new to Java and i found how to write spinner code Spinner | Android Developers
    since i dont have Java knowledge i have tow questions :

    first question :

    how do i change the code in spinner that when i choose lets say "Venus" it will show me the number 555
    i have changed the code like that but it dose not work :

    Java Code:

    public class MyOnItemSelectedListener implements OnItemSelectedListener {

    public void onItemSelected(AdapterView<?> parent,
    View view, int pos, long id){
    if (parent.getItemAtPosition(pos).toString().equals(" Venus"))
    {
    Toast.makeText(MyOnItemSelectedListener.this, "555", Toast.LENGTH_LONG).show();
    }
    public void onNothingSelected(AdapterView parent) {
    // Do nothing.
    }
    }

    second question :

    can I have link for learning writing Java code for android plez



    thanks for the helpers :)

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    786
    Rep Power
    5

    Default Re: drop down list

    toString().equals(" Venus") is not equals to lets say "Venus"


  3. #3
    nour is offline Member
    Join Date
    Oct 2011
    Posts
    12
    Rep Power
    0

    Default Re: drop down list

    i know little funny and stupid 2
    but i wasn't born with knowing Java programing
    so any help will be very appreciated

Similar Threads

  1. Please help : drop down list value not change after submit
    By kalyana in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 07-01-2011, 01:27 PM
  2. what code for searching in drop down list?
    By Harmesh Goyal in forum Advanced Java
    Replies: 1
    Last Post: 03-03-2011, 04:43 AM
  3. Replies: 0
    Last Post: 01-05-2011, 07:28 AM
  4. Populating a drop down list from a database
    By matpj in forum New To Java
    Replies: 0
    Last Post: 01-19-2009, 12:14 PM
  5. JComboBox and drop-down list.....HELP!!!!!
    By Anna in forum AWT / Swing
    Replies: 1
    Last Post: 06-18-2008, 05:16 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •