Reputation: 123
I have a question about navigation in android.
A have a frm1(activity) and a frm2(activity).
When I am in frm1, I press some item of a list, and a popup appears, and then the android send me to frm2. And when I press the return button, the android send me to frm1 showing the popup. =( . How can I avoid this(make android show me frm1 without the popup). Maybe you are saying, "so, why dont you do an intent ". The thing is that i dont wanna miss the state of frm1
thanks
this is the code whan i use the intent from frm1 to frm2,
*Onclick function for the list in frm1
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,long arg3){
AddDebtToTransaction(pos);
}
});
@SuppressLint("ShowToast")
public void AddDebtToTransaction(final int pos)
{
final CharSequence[] items = {"Ver Detalle", "Agregar a la Transacción"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("¿Qué desea hacer?");
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Intent i2 = new Intent(Frmpayment_searchdebts.this,Frmpayment_transactiondebt.class);
startActivity(i2);
});
builder.create();
builder.show();
}
Upvotes: 0
Views: 195
Reputation: 1095
You could use startActivityForResult
when going to frm2 and in frm1 overriding onActivityResult and using dismissDialog()
in there.
More information can be found here: developer.android.com
Upvotes: 1