0

我正在尝试将 OnItemSelectedListener 设置为 Spinner 和 AutoComplete textView 并且根据我的 logcat 永远不会达到整个 OnItemSelectedListener

代码:

public class ContactEditFragment extends Fragment implements OnClickListener,
    OnItemSelectedListener {
...
static Spinner reminderSelect;
private static AutoCompleteTextView contactWith;
...
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
...
        reminderSelect = (Spinner) rootView.findViewById(R.id.reminder_selector);
    reminderSelect.setOnItemSelectedListener(this);

 ...// Adapter and stuff
contactWith = (AutoCompleteTextView) rootView.findViewById(R.id.contactWith);
    contactWith.setOnItemSelectedListener(this);

OnItemSelectedListener:

  @Override
public void onItemSelected(AdapterView<?> parent, View view, int pos,
        long id) {

    Log.wtf("fd", "GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG");


    switch (view.getId()) {
    case R.id.reminder_selector:

                   Log.wtf("fd", "FFFFFFF"); // never reached

        choosenReminder = Integer.toString(pos);
        switch (pos) {
        case 5: //Custom reminder

            reminderSpinnerParent = parent;
            DialogFragment newFragmentTime = new TimePickerFragment();   
            Bundle argsTime = new Bundle();
            argsTime.putInt("customReminder", 2);
            newFragmentTime.setArguments(argsTime);      
            newFragmentTime.show(getFragmentManager(), "timePicker");
            setCustomReminderText(reminderSpinnerParent);
            choosenReminder = customReminderText;

            break;
        default:
            break;
            }


    case R.id.contactWith:
        isAutoCompleted = true;
        break;


    }
}

线

Log.wtf("fd", "GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"); 

仅当整个片段被充气时才会出现在 LogCat 中,该行

Log.wtf("fd", "FFFFFFF");

从未发布到 logcat 为什么会发生这种情况?

4

1 回答 1

0

我做对了,问题是我错过了一些休息;(s)那里

于 2013-08-02T09:20:33.937 回答