简体   繁体   中英

How to navigate to new activity by using two spinners and onclick submit button?

activity_assessment.xml

assessment.java

assessment.java arrays.xml

Eventhough , i am clicking on submit button i am unable to move to another activity. Can you please help me in this how to navigate to other new activity by using two spinners and a submit button? Above i attached my source code files

DON'T USE == in the if statement if(SpinnerValue1)

USE

.equals("TEST-1")

Like:

if(SpinnerValue1.equals("TEST-1"))

because SpinnerValue is an Object and you can't logically compare objects with "=="

See this

Also, I have this simple way of working with spinners :

spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
    @Override
    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
        //Instead of using getSelected(), use position 
        spinnerValue = position;
        //or
        useValueFrom(yourDataArrayAt[position]);
    }

    @Override
    public void onNothingSelected(AdapterView<?> parent) {

    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM