Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EditText edtVao = (EditText) findViewById(R.id.vao);
- final int edtVaoNum = Integer.parseInt(edtVao.getText().toString());
- // Spinner
- Spinner spnCargas = (Spinner) findViewById(R.id.spn_cargas);
- ArrayAdapter<CharSequence> spnAdapter = ArrayAdapter.createFromResource(this, R.array.str_cargas, R.layout.spinner_style);
- spnAdapter.setDropDownViewResource(R.layout.spinner_dropdown_style);
- spnCargas.setAdapter(spnAdapter);
- // Spinner
- spnCargas.setOnItemSelectedListener(
- new AdapterView.OnItemSelectedListener() {
- public void onItemSelected(AdapterView<?> spnAdpView, View v, int carga, long id) {
- int porcentagem;
- if(spnAdpView.getItemAtPosition(carga).toString() == "Cargas pequenas"){ porcentagem = 4; }
- else if(spnAdpView.getItemAtPosition(carga).toString() == "Cargas médias"){ porcentagem = 5; }
- else { porcentagem = 6;}
- }// fecha onItemSelected
- public void onNothingSelected(AdapterView<?> arg0){}
- }//fecha OnItemSelectedListener
- ); // fecha setOnItemSelectedListener
- int r = edtVaoNum * porcentagem / 100;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement