title: Android Action Bar navigation up button not working on devices
body: <p>Action Bar up navigation button <img src="https://i.stack.imgur.com/FLsTj.png" alt="Action Bar Back Button">  works fine in emulator but does not work in device can any one help me out</p>
  
  <p><strong>MainActivity</strong></p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);     
      setContentView(R.layout.mainpage);
  
      tf = Typeface.createFromAsset(getAssets(), "font/AGENCYB.TTF");
  
      Button btnWeatherDetails = (Button) findViewById(R.id.btnWeather);
      Button btnMovieDetails = (Button) findViewById(R.id.btnMovies);
      Button btnHoroscopeDetails = (Button) findViewById(R.id.btnHoroscope);
  
      btnWeatherDetails.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {               
              Intent i = new Intent(MainActivity.this, WeatherActivity.class);
              MainActivity.this.startActivity(i);
          }
      });
  
  
      btnMovieDetails.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View arg0) {
  
              Intent i = new Intent(MainActivity.this, MovieActivity.class);
              MainActivity.this.startActivity(i);             
          }
      });
  
      btnHoroscopeDetails.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View arg0) {
  
              Intent i = new Intent(MainActivity.this, HoroscopeActivity.class);
              MainActivity.this.startActivity(i);     
          }
      });
  
  }
  
  @Override
  protected void onDestroy() {
  
      SharedPreferences settingsPreferences = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
      SharedPreferences.Editor settingsEditor= settingsPreferences.edit();
      settingsEditor.putBoolean(MovieActivity.MOVIEUPDATED, false);
      settingsEditor.putBoolean(HoroscopeActivity.HOROSCOPEAVAILABLE, false);
      settingsEditor.commit();
  
      super.onDestroy();
  }
  </code></pre>
  
  <p>WeatherActivity</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.scrollmain);
      getActionBar().setDisplayHomeAsUpEnabled(true);
  
      settingsPreferences = getSharedPreferences(MainActivity.PREF_NAME, MODE_PRIVATE);
      SavedString = settingsPreferences.getString(JSONWEATHERSTRING, "Not Found");
  
      new JSONParse().execute(WeatherUrl);
  
  }
  
  public boolean onCreateOptionMenu(Menu menu)
  {
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  
  public boolean onOptionItemSelected(MenuItem item)
  {
      switch(item.getItemId()){
      case android.R.id.home:
          NavUtils.navigateUpFromSameTask(this);
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  
  public void onBackPressed()
  {
      moveTaskToBack(true);
      WeatherActivity.this.finish();
  }
  </code></pre>
  
  <p>MovieActivity</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      settingsPreferences = getSharedPreferences(MainActivity.PREF_NAME, MODE_PRIVATE);
  
      MovieJsonString = settingsPreferences.getString(JSONMOVIESTRING, "Not Found");
      isMovieUpdated = settingsPreferences.getBoolean(MOVIEUPDATED, false);
  
      setContentView(R.layout.main_list_view);        
      getActionBar().setDisplayHomeAsUpEnabled(true);
  
      movieList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
      list = getListView();
      // Calling async task to get json
      if(!isMovieUpdated)
          new GetMovieDetails().execute();
      else
          GetMoviePreferences();
  
  }
  
  public boolean onCreateOptionMenu(Menu menu)
  {
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  
  public boolean onOptionItemSelected(MenuItem item)
  {
      switch(item.getItemId()){
      case android.R.id.home:
          NavUtils.navigateUpFromSameTask(this);
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  
  public void onBackPressed()
  {
      moveTaskToBack(true);
      MovieActivity.this.finish();
  }
  </code></pre>
  
  <p>HoroscopeActivity</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.horoscope);
      getActionBar().setDisplayHomeAsUpEnabled(true);
  
      settingsPreferences = getSharedPreferences(MainActivity.PREF_NAME, MODE_PRIVATE);
  
      isHoroAvailable = settingsPreferences.getBoolean(HOROSCOPEAVAILABLE,false);
  
      if(!isHoroAvailable)
          new XMLParse().execute();
      else
          GetHoroscopeFromPreference();
  }
  
  public boolean onCreateOptionMenu(Menu menu)
  {
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  
  public boolean onOptionItemSelected(MenuItem item)
  {
      switch(item.getItemId()){
      case android.R.id.home:
          NavUtils.navigateUpFromSameTask(this);
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  
  public void onBackPressed()
  {
      moveTaskToBack(true);
      HoroscopeActivity.this.finish();
  }
  </code></pre>
  
  <p><strong>Manifest File</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="in.datumdata.weather"
      android:installLocation="auto"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="18" /&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_hosurdata"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="in.datumdata.hosurdata.MainActivity"
              android:label="@string/app_name"
              android:screenOrientation="portrait" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name="in.datumdata.hosurdata.MovieActivity"
              android:label="Movie Details"
              android:parentActivityName="in.datumdata.hosurdata.MainActvity"
              android:screenOrientation="portrait" /&gt;
          &lt;activity
              android:name="in.datumdata.hosurdata.WeatherActivity"
              android:label="Weather Details"
              android:parentActivityName="in.datumdata.hosurdata.MainActvity"
              android:screenOrientation="portrait" /&gt;
          &lt;activity
              android:name="in.datumdata.hosurdata.SingleContactActivity"
              android:label="Movie Details"
              android:parentActivityName="in.datumdata.hosurdata.MovieActivity"
              android:screenOrientation="portrait" /&gt;
          &lt;activity
              android:name="in.datumdata.hosurdata.HoroscopeActivity"
              android:label="Horoscope Details"
              android:parentActivityName="in.datumdata.hosurdata.MainActvity"
              android:screenOrientation="portrait" /&gt;
          &lt;activity
              android:name="in.datumdata.hosurdata.SingleHoroscopeActivity"
              android:label="Horoscope Details"
              android:parentActivityName="in.datumdata.hosurdata.HoroscopeActivity"
              android:screenOrientation="portrait" /&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>In all the above activities the navigation button <img src="https://i.stack.imgur.com/FLsTj.png" alt="Action Bar Back Button"> works fine in emulator but on device it does not work and when i press the back button on the device <img src="https://i.stack.imgur.com/dWLpL.png" alt="enter image description here"> the application goes invisible i mean to say its running in the background. This thing happens on all activities on whatever activity i press back button the same thing happens </p>
  
  <p>help me out. thanks in advance and sorry for my bad english.</p>