> So now my question:
> Is there a Method to determine if a spinner is fully added to the
> screen (or to a view)?
> Or in other words:
> Is there a Method to determine if the layout-process of a View is
> fully finished?

I found a workaround.
1. Be sure that when you create the spinners dynamically (not by xml,
but by code), that you assign an ID to the spinner.
2. Set a Global Variable in your class:
private HashSet<Integer> spinnersEnabledForOnItemSelected = new
HashSet<Integer>();

3. Whenn you create your Spinners overwrite the Method onClick
Spinner spinner = new Spinner(parentActivity){
  @Override
  public void onClick(DialogInterface dialog, int which) {
  // This Method is only called, when the Spinner is "open",
  // I mean when you see all the Items of the spinner, after clicking
  // on an Item
        spinnersEnabledForOnItemSelected.add(this.getId());
        super.onClick(dialog, which);
  }
};


4. inside the OnItemSelectedListener inside the Method onItemSelected
you check if minimum one click happened
onItemSelected(AdapterView<?> arg0, View aSelectedTextView, int
position, long idOfTheSelectedTextView) {
  Spinner spinner = (Spinner)arg0;
  int id = spinner.getId();
  if (! spinnersEnabledForOnItemSelected.contains(id)){
    return;
  }
  // additional code here...
}

5. before you add a spinner to your parentview or linearlayout

spinnersEnabledForOnItemSelected.remove(aSpinner.getId());
yourParentLinearLayout.addView(aSpinner);

--> now it is guaranteed that the procedures inside the Method
onItemSelected are getting only processed after the first click or
touch by the user

I am happy when I get some other or better solutions to clean up my
brain :-)
Regards from Austria
Anil

-- 
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

Reply via email to