getSelectedItem() crashed Android, please help

  • Antworten:2
Pascal Nagel
  • Forum-Beiträge: 2

31.03.2012, 15:57:39 via Website

Hey,
the following lines crash android with a NPE:

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

Object type = spinner.getSelectedItem();

I checked the id for correct spelling in the xml.
The spinner is being populated in the first activity, after a button is pressed a new activity is opened corresponding to the class containing the above code.

Please Help
Pascal

Antworten
Ansgar M
  • Forum-Beiträge: 1.544

31.03.2012, 22:22:37 via App

Which of those two lines is referenced as the crashing line in logcat?

Antworten
Pascal Nagel
  • Forum-Beiträge: 2

31.03.2012, 22:25:21 via Website

I figured it out, needed to pass the data along to the other activity. Thanks anyhow :)

Antworten