我正在尝试将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 为什么会这样?
答案 0 :(得分:0)
我做对了,问题是我错过了一些休息;(s)那里