Good day! Interested in such a question. There is a MainActivity
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Spinner spinner = (Spinner) findViewById(R.id.bodySpiner); bodySelected = spinner.getSelectedItem().toString(); Test1 = position; Intent intent = new Intent(getBaseContext(), Engine.class); intent.putExtra("Test1", Test1); startActivity(intent); } @Override public void onNothingSelected(AdapterView<?> arg0) { } In Engine.class
Intent i = getIntent(); String id = i.getStringExtra("Test1"); Is it possible to somehow transfer the int value of the selected position? Just based on this choice, I need to do a sorting.
i.getIntExtra(Test1)or what's the problem? - Jarvis_JdefaultValuewill be returned from the method if no value is found by the passed key. Attach a standard error. - temqTest1in general? put in theintentpositionimmediately. Everything should work with any default, see the problem elsewhere. Perhaps you are running anintentnot in a UI thread? - Jarvis_J