HY,
有没有办法改变OnItemSelectedListener()方法的参数集? 所以不要那样:
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
}
类似的东西:
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id, String myString) {
}
基本上我想从我的适配器向我的活动发送一个字符串。 那有办法吗? 提前谢谢!
编辑: 所以在这个片段中我有一个String数组,我希望得到一个对应于我在我的微调器中单击的位置。
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_createitem, container, false);
currentDate.setTime(new Date(System.currentTimeMillis()));
title = (EditText) view.findViewById(R.id.Title);
date = (EditText) view.findViewById(R.id.Date);
date.setText(buildDateText(currentDate));
date.setOnClickListener(this);
calIMG = (ImageView) view.findViewById(R.id.CalIMG);
calIMG.setOnClickListener(this);
value = (EditText) view.findViewById(R.id.Value);
image = (ImageView) view.findViewById(R.id.Image);
image.setOnClickListener(this);
mySpinner = (Spinner) view.findViewById(R.id.spinner);
mySpinner.setAdapter(new MySpinnerAdapter(getActivity().getApplicationContext(), icons));
mySpinner.setSelection(0, false);
mySpinner.setOnItemSelectedListener(this);
.
.
.