CancelDownload.java :  » Client » catdroid-repository » org » catdroid » apps » Android Open Source

Android Open Source » Client » catdroid repository 
catdroid repository » org » catdroid » apps » CancelDownload.java
package org.catdroid.apps;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;

public class CancelDownload extends Activity {
  private static final String TAG = "CancelDownload";
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    //De moment, farem que canceli la descarrega amb nomes clickarhi, potser mes endavant interessa confirmar?
    Log.i(TAG, "onCreate");
    Bundle extras = getIntent().getExtras();
    if(extras != null) {
      String url = extras.getString("org.catdroid.apps.url");
      if(url != null) {
        Log.i(TAG, "Cancelando: " + url);
        setCancelled(url);
      } else Log.i(TAG, "Url null");
    } else Log.i(TAG, "Extras null");
    finish();
    super.onCreate(savedInstanceState);
  }
  
  private void setCancelled(String url) {
    Log.i(TAG, "setCancelled: " + url);
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
    SharedPreferences.Editor editor = settings.edit();
    editor.putBoolean(url, true);
    editor.commit();
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.