/** Controls behavior of the back button */
 @Override
 public void onBackPressed() {
   // Only close apps when there's no backstack
   if (getSupportFragmentManager().getBackStackEntryCount() <= 1) {
     finish();
   } else {
     super.onBackPressed();
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    DisplayImageOptions defaultOptions =
        new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(true).build();

    ImageLoaderConfiguration config =
        new ImageLoaderConfiguration.Builder(getApplicationContext())
            .defaultDisplayImageOptions(defaultOptions)
            .build();

    ImageLoader.getInstance().init(config);
  }