选择微调项时如何显示 ImageView

How to display ImageView when I'm choose spinner item

 private String[] genre = { "Action", "Adventure", "Comedy", "Biography", "Drama", "Family", "Horror", "Romance" }; 
 private Integer images[] = { R.drawable.img_action, R.drawable.img_adventure, R.drawable.img_biografy, R.drawable.img_comedy, R.drawable.img_drama, R.drawable.img_family, R.drawable.img_horror, R.drawable.img_romantis };
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    setInitialImage();

    spinner = (Spinner) findViewById(R.id.label_spinner);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(       // make array adapter
            this, android.R.layout.simple_spinner_item, genre
        );

    spinner.setAdapter(adapter);   // connect adapter with  spinner
    spinner.setOnItemSelectedListener(new OnItemSelectedListener() {     // get item from spinner

        @Override
        public void onItemSelected(AdapterView<?> parent, View view,
                int position, long id) {
            // TODO Auto-generated method stub
            int index = spinner.getSelectedItemPosition();

            if () {

                currImage = images[0];  
                Toast.makeText(getBaseContext(), "Anda memilih genre film "+ genre[index], Toast.LENGTH_SHORT)
                .show();
            }
            setCurrentImage(); // called method

        }

    });     

}

如何,当我单击其中一个微调项时,电影类型的图像就会出现。 我应该在 if 语句中输入什么?

谁能帮我解决这个问题?

将您的onItemSelectedMethod修改为以下

@Override
public void onItemSelected(AdapterView<?> parent, View view,
                int position, long id) {
      currImage = images[position];  
      Toast.makeText(getBaseContext(), "Anda memilih genre film "+ genre[index], Toast.LENGTH_SHORT)
                .show();
      setCurrentImage(); // called method
}