Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Intent- FLAG_ACTIVITY_NO_HISTORY not working

I have three activities say A B C , from activity A i go to B and and search city and from Activity B iam going to Activity c , in c iam saving something which i put in Async task and this will be saved in Activit A listview, the problem is after saving in the list when i hit back button i again see the Activity A with not saving the name which i previously saved

private class Savecity extends AsyncTask<city, String, String> {

        @Override
        protected void onPostExecute(String result) {
            super.onPostExecute(result);
            if(result != null && result.equals("sucess")){

            Intent intent = new Intent(activity, cityActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
            startActivity(intent);}

        }
        @Override
        protected String doInBackground(city... arg0) {
            try {
                ((CityPreferences) activity.getApplication()).createcity(arg0[0]);

                return "sucess";
            } catch (Exception e) {
                Log.e(TAG, "", e);
                return "fail";
            }
        }
like image 910
teekib Avatar asked Nov 28 '22 05:11

teekib


1 Answers

You can implement this from your AndroidManifest.xml file, just add android:noHistory="true" attribute in those <activity> you want

hope this helps..

like image 199
zennon Avatar answered Dec 15 '22 20:12

zennon