0

如何设置哈希表?我有两个变量,即书名和章数,在微调器内。我想根据书名和章数设置文本视图。那我该怎么做?

4

1 回答 1

0

基本上,您将元素放在 Arraylist 中。

您需要做的就是获取在此微调器中选择的元素。

spinner
    .setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
    public void onItemSelected(AdapterView<?> parentView,
    View selectedItemView, int position, long id) {
    //selectedItemView.invalidate()
    Toast.makeText(Registration_Screen.this,
    arrayList.get(position) + "",
        Toast.LENGTH_LONG).show();

        }

    @Override
    public void onNothingSelected(AdapterView<?> parentView) {
    Toast.makeText(Registration_Screen.this,
        "Nothing Selected", Toast.LENGTH_LONG).show();

    spinner.setVisibility(View.GONE);
                    }
                });

所以现在你有了数组列表的位置,你的项目在哪里。

让 mw 知道这是否有效。

于 2012-01-20T15:15:15.643 回答