public void onClick(View v) { MyApplication myApp = ((MyApplication) getApplication()); String name = acctName.getText().toString(); PaymentMethod newMethod = new PaymentMethod(); newMethod.setName(name); newMethod.setInfo(""); myApp.addAccount(newMethod); Toast.makeText( getApplicationContext(), myApp.paymentNames().get(myApp.accountsSize() - 1) + "has been added", Toast.LENGTH_LONG) .show(); }