@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); main = getLayoutInflater().inflate(R.layout.account, null); list = (TableLayout) main.findViewById(R.id.accounttable); tvbalance = (TextView) main.findViewById(R.id.accountbalance); setContentView(main); prompt = getLayoutInflater().inflate(R.layout.dialogaccount, null); accamount = (MyTextBox) prompt.findViewById(R.id.accountamount); accnumber = (MyTextBox) prompt.findViewById(R.id.accountnumber); accbank = (MyTextBox) prompt.findViewById(R.id.accountbank); accname = (MyTextBox) prompt.findViewById(R.id.accountholder); dialog = new AlertDialog.Builder(this) .setPositiveButton("Submit", null) .setNegativeButton("Cancel", null) .setMessage("Fill up the details below. Our customer service will contact you shortly") .setTitle("Request payment") .create(); dialog.setView(prompt); dialog.setOnShowListener(this); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setIcon(android.R.color.transparent); HashMap<String, Object> pars = new HashMap<String, Object>(); pars.put("loginkey", Shared.loginkey); request = SimpleHttp.request("list", Shared.url + "profile/getAccountHistory", pars, this); }
@Override public void onClick(View v) { if (accbank.getText().length() == 0) return; if (accamount.getText().length() == 0) return; if (accname.getText().length() == 0) return; if (accnumber.getText().length() == 0) return; HashMap<String, Object> pars = new HashMap<String, Object>(); pars.put("loginkey", Shared.loginkey); pars.put("bank", accbank.getText()); pars.put("amount", accamount.getText()); pars.put("name", accname.getText()); pars.put("number", accnumber.getText()); request = SimpleHttp.request("request", Shared.url + "profile/requestPayment", pars, this); Button buttonok = dialog.getButton(DialogInterface.BUTTON_POSITIVE); buttonok.setText("Please wait..."); buttonok.setEnabled(false); dialog.getButton(DialogInterface.BUTTON_NEGATIVE).setVisibility(View.GONE); }
@Override protected void onPause() { super.onPause(); if (request != null) request.abort(); }