Spinner item does not work

I ahve an application with a spinner drop down menu. When I tap Admin from spinner drop down menu it does not go to Admin.class. And same with Teacher, when I tap Teacher from spinner drop down menu it does not go to Student.class.\

My code:

public class Home extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);

        String[] sp1 = getResources().getStringArray(R.array.Level);
        Spinner spinner = (Spinner)findViewById(R.id.spinner);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,sp1);
        spinner.setAdapter(adapter);

        spinner.setOnItemSelectedListener(new OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

                String s = parent.getItemAtPosition(position).toString();
                if(s=="Admin")
                    startActivity(new Intent(Home.this,Admin.class));
                if(s=="Teacher")
                    startActivity(new Intent(Home.this,Student.class));
            }

            public void onNothingSelected(AdapterView<?> arg0) {
                // TODO Auto-generated method stub
            }
        });
    }
}


Download spinner.item.does.not.work.zip
Direct Link


Download


Download spinner.item.does.not.work.zip
Mediafire


Download


Download spinner.item.does.not.work.zip
Filemoney


Download

Both comments and pings are currently closed.

Comments are closed.