I have an activity for showing tour details with two inconsistent goals
First that activity has a booking button which redirects to bank pay and get back to activity after successful or unsuccessful pay.that is why i set Launch Mode in manifest to stop activity from re creating.
android:launchMode="singleTask"
Second
that activity has a button which redirect to similar tour,then i have to call finish();
before startActivity()
to make intent work!
onNewIntent()
inside activity to get data of first part
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (intent.getData() != null) {
Helper.logDebug("fsfsfsgsgsgs", "inside get data not null");
String query = intent.getData().getQuery();
Helper.logDebug("fsfsfsgsgsgs","query is "+ query);
if (query!=null && query.contains("Status=OK")) {
if (frgBtmReserve!=null){
frgBtmReserve.dismiss();
}
String count=query.substring(16);
Helper.logDebug("fsfsfsgsgsgs","count is "+ count);
frgObjectInfo.updateReserveCount(count);
Helper.logDebug("fsfsfsgsgsgs", "inside status ok");
Helper.notifyUserDone(getResources().getString(R.string.success_tour_reserve), this,R.drawable.ic_tick);
} else {
frgBtmReserve.dismiss();
Helper.logDebug("fsfsfsgsgsgs", "inside status nok");
Helper.notifyUserWarning(getResources().getString(R.string.error_tour_reserve), this);
}
}
}
on click of second part which should create new instance of current activity but it doesnt because of launch mode of activity which is singleTask
.intent doesnt work until i finish()
before startActivity()
Intent intent = new Intent(context, ActivityShowObject.class);
intent.putExtra(ActivityShowObject.INTENT_KEY_TYPE, Obj.TYPE_TRAVEL);
intent.putExtra(ActivityShowObject.INTENT_KEY_COLOR, color);
intent.putExtra(ActivityShowObject.INTENT_KEY_OBJ_ID, obj.getAgencyId());
((AppCompatActivity)context).finish();
startActivity(intent);
Animatoo.animateShrink(context);
that is my problem think of a user which is looking into some similar tours then press back and app goes back to the very first step! do you guys have a suggestion for me?