Hello,
I need to pass the two-screen parameters to the home screen , or the "BALANCE" parameters of the balance screen where it will be passed to an EditText (lblStandard) start screen and then take a value set to "EXTRA" on the addarsaldo screen and add to the "BALANCE" parameter and show in the ActualScreen on the home screen screen >
Help please Thank you.
SCREENSHOW screenshot
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tela_inicio);
lblSaldoAtual = (TextView) findViewById(R.id.lblSaldoAtual);
btnSaldo = (Button) findViewById(R.id.btnSaldo);
lblSaldoTotal = (TextView) findViewById(R.id.lblSaldoTotal);
btnMenos = (ImageView) findViewById(R.id.btnMenos);
bMais = (Button) findViewById(R.id.bMais);
bMenos = (Button) findViewById(R.id.bMenos);
btnSaldo.setOnClickListener(this);
btnMenos.setOnClickListener(this);
bMais.setOnClickListener(this);
bMenos.setOnClickListener(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Classe1 classe = new Classe1();
classe.recebesaldo();
classe.recebeextra();
}
class Classe1 {
Double extra, saldoatual, saldototal, total;
public void recebesaldo() {
Intent it = getIntent();
if (it != null) {
Bundle b1 = it.getExtras();
saldoatual = Double.parseDouble(b1.getString("SALDO"));
lblSaldoAtual.setText(Double.toString(saldoatual));
saldototal = Double.parseDouble(b1.getString("SALDO"));
lblSaldoTotal.setText(Double.toString(saldototal));
}
}
public void recebeextra() {
Intent it2 = getIntent();
extra = Double.parseDouble(it2.getStringExtra("EXTRA"));
total = extra + saldoatual;
lblSaldoAtual.setText(Double.toString(total));
}
}
public void onClick(View view) {
if (view == btnSaldo) {
Intent it = new Intent(this, saldo.class);
startActivity(it);}
else if (view == bMais) {
Intent it = new Intent(this, acrescentarsaldo.class);
startActivity(it);
} else if (view == bMenos) {
Intent it = new Intent(this, acrescentarsaldo.class);
startActivity(it);
}
}
ADDOSAL TAB
public class acrescentarsaldo extends AppCompatActivity implements View.OnClickListener{
private Button btnOK;
private EditText txtAcrescentarSaldo;
public static String acrescenta;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_acrescentarsaldo);
btnOK = (Button) findViewById(R.id.btnOK);
txtAcrescentarSaldo = (EditText) findViewById(R.id.txtAcrescentarSaldo);
btnOK.setOnClickListener(acrescentarsaldo.this);
}
public static String getAcrescenta(){
return acrescenta;
}
public void onClick(View v) {
Intent it = new Intent(acrescentarsaldo.this, tela_inicio.class);
it.putExtra("EXTRA", txtAcrescentarSaldo.getText().toString());
startActivity(it);
}
}
SCREEN
public class saldo extends AppCompatActivity implements View.OnClickListener{
private EditText txtAtualizar;
private Button btnAtualizar;
private static String saldo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_saldo);
btnAtualizar = (Button) findViewById(R.id.btnAtualizar);
txtAtualizar = (EditText) findViewById(R.id.txtAtualizar);
btnAtualizar.setOnClickListener(saldo.this);
}
public static String getSaldo(){
return saldo;
}
@Override
public void onClick(View view) {
Intent it = new Intent(saldo.this, tela_inicio.class);
it.putExtra("SALDO", txtAtualizar.getText().toString());
startActivity(it);
}
}