Tuesday, March 20, 2012

[android-developers] Re: Re : Button onclick

hi,
     I want to display a spinner on clicking the button and i m trying like this :

     submit.setOnClickListener((OnClickListener) this);

and in OnClick :

     public void onClick(View v) {
                   
                    setContentView(R.layout.offense);
                    spinner = (Spinner) findViewById(R.id.spinner);
                   
                    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
                            this, R.array.planets_array, android.R.layout.simple_spinner_item);
                    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                    spinner.setAdapter(adapter);
                }

when running this my application crashes.and in log error

03-20 11:19:26.501: E/AndroidRuntime(1338): FATAL EXCEPTION: main
03-20 11:19:26.501: E/AndroidRuntime(1338): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.otc.offense/com.otc.offense.Bookingpage}: java.lang.ClassCastException: com.otc.offense.Bookingpage

On Tuesday, March 20, 2012 2:24:27 PM UTC+5:30, vivek elangovan wrote:
Hi members,
                    In my application i need fill input data when i click some button.So on clicking the button then only i need to display input field  otherwise i have to hide fields and have to fill data

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment