/** * Reads the UI email field and searches for a client with the given email. If the given email is * empty, shows all clients available in the system. If a client with the given email is found, * shows the personal and billing information of the client. If no client is found, displays a * message saying that no client was found. * * @param view the current view */ public void searchClient(View view) { // Input from EditText EditText editEmail = (EditText) findViewById(R.id.editClientEmailText); String textEmail = editEmail.getText().toString(); // Input from Spinner Spinner spinner = (Spinner) findViewById(R.id.client_email_spinner); String spinnerEmail = spinner.getSelectedItem().toString(); // If input from EditText is empty, use the selected email address // from spinner String email = null; if (!textEmail.matches("")) { email = textEmail; } else { email = spinnerEmail; } Client client = null; try { client = dc.getClient(email); } catch (Exception e) { } if (client == null) { Toast.makeText( getApplicationContext(), "There is no client with the" + " given email.", Toast.LENGTH_LONG) .show(); } else { Intent intent = new Intent(this, ViewClientInfoActivity.class); intent.putExtra("clientEmail", email); startActivity(intent); } }