This largely depends on what you want to do with the spinner.
The example below will let the user select from 4 pre-defined values
(you'll have to put this into your own
class; "YourClass"):
The obvious disclaimers apply, but it should work (toast the value you
have spun to).
public String[] spPos = { "ONE", "TWO", "THREE", "FOUR" };
sp_pos = (Spinner) findViewById(R.id.spinner_name_in_main_xml);
ArrayAdapter<String> aspnPos = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, spPos);
aspnPos.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp_pos.setAdapter(aspnPos);
sp_pos.setSelection(1); // make default spinner value show "ONE"
sp_pos.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onNothingSelected(AdapterView<?> parent) {
// do nothing
}
public void onItemSelected(AdapterView<?> parent, View v, int
position, long id) {
int pos = sp_pos.getSelectedItemPosition();
String str = spPos[pos];
Toast.makeText(YourClass.this, "You have selected: " +
str,Toast.LENGTH_LONG).show();
}
});
On Mar 19, 12:22 pm, satish bhoyar <[email protected]> wrote:
> Does anyone have solution on scroller?
> pls help
>
> On Thu, Mar 18, 2010 at 8:03 PM, satish bhoyar <[email protected]>wrote:
>
> > Hello all,
>
> > How to use Scroller in an application? do anyone have any reference?
>
> > please help .
>
> > Thanks,
> > satish
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe from this group, send email to
android-developers+unsubscribegooglegroups.com or reply to this email with the
words "REMOVE ME" as the subject.