List of usage examples for android.content Intent ACTION_DELETE
String ACTION_DELETE
To view the source code for android.content Intent ACTION_DELETE.
Click Source Link
From source file:com.amaze.carbonfilemanager.fragments.AppsList.java
public boolean unin(String pkg) { try {//from w w w . j a v a 2 s .c o m Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:" + pkg)); startActivity(intent); } catch (Exception e) { Toast.makeText(getActivity(), "" + e, Toast.LENGTH_SHORT).show(); e.printStackTrace(); return false; } return true; }
From source file:org.adaway.ui.adware.AdwareFragment.java
/** * Uninstall adware./*w w w .j a v a 2 s.c om*/ * * @param adwareInstall The adware to uninstall. */ private void uninstallAdware(AdwareInstall adwareInstall) { Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:" + adwareInstall.get(AdwareInstall.PACKAGE_NAME_KEY))); this.startActivity(intent); }
From source file:edu.mit.mobile.android.locast.ver2.casts.CastDetail.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cast_detail); initOverlays();// w w w .j a v a 2 s . com final Uri data = getIntent().getData(); mCastMediaUri = Cast.getCastMediaUri(data); mMapController = ((MapView) findViewById(R.id.map)).getController(); mLoaderManager = getSupportLoaderManager(); mLoaderManager.initLoader(LOADER_CAST, null, this); mLoaderManager.initLoader(LOADER_CAST_MEDIA, null, this); findViewById(R.id.home).setOnClickListener(this); findViewById(R.id.refresh).setOnClickListener(this); vcb = (ValidatingCheckBox) findViewById(R.id.favorite); vcb.setValidatedClickHandler(new MyFavoriteClickHandler(this, data)); final Gallery castMediaView = (Gallery) findViewById(R.id.cast_media); mCastMedia = new CastMediaAdapter(this); castMediaView.setEmptyView(findViewById(android.R.id.empty)); castMediaView.setAdapter(new ImageLoaderAdapter(this, mCastMedia, ImageCache.getInstance(this), new int[] { R.id.media_thumbnail }, 480, 360, ImageLoaderAdapter.UNIT_DIP)); castMediaView.setOnItemClickListener(this); castMediaView.setEnabled(true); final String action = getIntent().getAction(); if (Intent.ACTION_DELETE.equals(action)) { showDialog(DIALOG_CONFIRM_DELETE); } }
From source file:edu.mit.mobile.android.locast.casts.CastDetail.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cast_detail); mProgressBar = (NotificationProgressBar) (findViewById(R.id.progressNotification)); final Uri data = getIntent().getData(); mCastMediaUri = Cast.getCastMediaUri(data); if (USE_MAP) { initOverlays();//from ww w . j av a 2 s. co m // mMapController = ((MapView) findViewById(R.id.map)).getController(); } else { final View mapContainer = findViewById(R.id.pointer_shadow); if (mapContainer != null) { mapContainer.setVisibility(View.GONE); } } mLoaderManager = getSupportLoaderManager(); mLoaderManager.initLoader(LOADER_CAST, null, this); mLoaderManager.initLoader(LOADER_CAST_MEDIA, null, this); findViewById(R.id.home).setOnClickListener(this); findViewById(R.id.refresh).setOnClickListener(this); mRefresh = (RefreshButton) findViewById(R.id.refresh); mRefresh.setOnClickListener(this); final Gallery castMediaView = (Gallery) findViewById(R.id.cast_media); mCastMedia = new CastMediaAdapter(this); castMediaView.setEmptyView(findViewById(R.id.progressNotification)); castMediaView.setAdapter(new ImageLoaderAdapter(this, mCastMedia, ImageCache.getInstance(this), new int[] { R.id.media_thumbnail }, 480, 360, ImageLoaderAdapter.UNIT_DIP)); castMediaView.setOnItemClickListener(this); castMediaView.setEnabled(true); final String action = getIntent().getAction(); if (Intent.ACTION_DELETE.equals(action)) { showDialog(DIALOG_CONFIRM_DELETE); } }
From source file:org.klnusbaum.udj.EventActivity.java
private void doQuit() { AccountManager am = AccountManager.get(this); am.setUserData(account, Constants.EVENT_STATE_DATA, String.valueOf(Constants.LEAVING_EVENT)); Intent leaveEvent = new Intent(Intent.ACTION_DELETE, Constants.EVENT_URI, this, EventCommService.class); leaveEvent.putExtra(Constants.ACCOUNT_EXTRA, account); startService(leaveEvent);// w w w. j av a2s. c o m setResult(Activity.RESULT_OK); finish(); }
From source file:com.dnielfe.manager.AppManager.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); int index = info.position; String packagename = mAppList.get(index).packageName; switch (item.getItemId()) { case ID_LAUNCH: Intent i = pm.getLaunchIntentForPackage(packagename); startActivity(i);/*ww w . j av a 2 s. co m*/ break; case ID_MANAGE: startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + packagename))); break; case ID_UNINSTALL: Intent i1 = new Intent(Intent.ACTION_DELETE); i1.setData(Uri.parse("package:" + packagename)); startActivity(i1); get_downloaded_apps(); break; case ID_MARKET: Intent intent1 = new Intent(Intent.ACTION_VIEW); intent1.setData(Uri.parse("market://details?id=" + packagename)); startActivity(intent1); break; case ID_SEND: try { ApplicationInfo info1 = pm.getApplicationInfo(packagename, 0); String source_dir = info1.sourceDir; File file = new File(source_dir); Uri uri11 = Uri.fromFile(file.getAbsoluteFile()); Intent infointent = new Intent(Intent.ACTION_SEND); infointent.setType("application/zip"); infointent.putExtra(Intent.EXTRA_STREAM, uri11); startActivity(Intent.createChooser(infointent, getString(R.string.share))); } catch (Exception e) { Toast.makeText(AppManager.this, "Error", Toast.LENGTH_SHORT).show(); } break; } return false; }
From source file:com.redhorse.quickstart.AppAll.java
public void onItemClick(AdapterView<?> arg0, View arg1, final int arg2, final long arg3) { // TODO Auto-generated method stub // ResolveInfo info = mApps.get(position); ////from ww w. j a v a 2 s . c om // Intent i = getIntent(); // Bundle b = new Bundle(); // b.putString("msg", "open"); // b.putString("packageName", info.activityInfo.packageName); // b.putString("name", info.activityInfo.name); // i.putExtras(b); // this.setResult(RESULT_OK, i); // dbStart.close(); // this.finish(); // TODO Auto-generated method stub AlertDialog opDialog = new AlertDialog.Builder(AppAll.this).setTitle("") .setItems(R.array.select_dialog_items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { /* User clicked so do some stuff */ String[] items = getResources().getStringArray(R.array.select_dialog_items); ResolveInfo info = null; ResolveInfo selectedinfo = null; switch (which) { case ITEM_ID_DELETE: selectedinfo = mApps.get(arg2); String packageName = selectedinfo.activityInfo.packageName; String name = selectedinfo.activityInfo.name; Iterator it1 = mAllApps.iterator(); while (it1.hasNext()) { info = (ResolveInfo) it1.next(); if (packageName.equals(info.activityInfo.packageName) && name.equalsIgnoreCase(info.activityInfo.name)) { Intent intent = new Intent(); Uri packageURI = Uri.parse("package:" + packageName); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); startActivityForResult(uninstallIntent, STARTUNINSTALL_REQUEST); break; } } break; case ITEM_ID_OPEN: info = mApps.get(arg2); Intent i = getIntent(); Bundle b = new Bundle(); b.putString("msg", "open"); b.putString("packageName", info.activityInfo.packageName); b.putString("name", info.activityInfo.name); i.putExtras(b); AppAll.this.setResult(RESULT_OK, i); dbStart.close(); AppAll.this.finish(); break; } } }).create(); opDialog.show(); }
From source file:edu.mit.mobile.android.livingpostcards.CardEditActivity.java
@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); mSherlock.setContentView(R.layout.activity_card_edit); final ActionBar ab = mSherlock.getActionBar(); ab.setDisplayHomeAsUpEnabled(true);/*ww w . j a va2 s.co m*/ mTitle = (EditText) findViewById(R.id.title); mDescription = (EditText) findViewById(R.id.description); final View addFrame = findViewById(R.id.add_frame); addFrame.setOnClickListener(this); mCard = getIntent().getData(); final String action = getIntent().getAction(); final FragmentManager fm = getSupportFragmentManager(); if (Intent.ACTION_EDIT.equals(action) || Intent.ACTION_DELETE.equals(action)) { final FragmentTransaction ft = fm.beginTransaction(); final Fragment f = fm.findFragmentById(R.id.card_edit_fragment); if (f != null) { mCardViewFragment = (CardMediaEditFragment) f; } else { mCardViewFragment = CardMediaEditFragment.newInstance(Card.MEDIA.getUri(mCard)); ft.replace(R.id.card_edit_fragment, mCardViewFragment); } // if the dialog has been automatically restored by the system, hook it in. final SetCollabDescDialogFragment collab = (SetCollabDescDialogFragment) fm .findFragmentByTag(TAG_DIALOG_COLLABORATIVE); if (collab != null) { collab.setOnMarkCollaborativeListener(mOnMarkCollabListener); } mUserUri = Authenticator.getUserUri(this, Authenticator.ACCOUNT_TYPE); getSupportLoaderManager().initLoader(0, null, this); // if this isn't null, it was saved automatically for us. So hook it back in. final DeleteDialogFragment deleteDialog = (DeleteDialogFragment) fm .findFragmentByTag(TAG_DELETE_DIALOG); if (deleteDialog != null) { deleteDialog.registerOnDeleteListener(this); } else if (Intent.ACTION_DELETE.equals(action)) { onDeletePostcard(); } ft.commit(); } }
From source file:org.fdroid.fdroid.installer.DefaultInstallerActivity.java
private void uninstallPackage(String packageName) { // check that the package is installed try {//w w w . j a va 2s .c om getPackageManager().getPackageInfo(packageName, 0); } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "NameNotFoundException", e); installer.sendBroadcastUninstall(packageName, Installer.ACTION_UNINSTALL_INTERRUPTED, "Package that is scheduled for uninstall is not installed!"); finish(); return; } Uri uri = Uri.fromParts("package", packageName, null); Intent intent = new Intent(); intent.setData(uri); if (Build.VERSION.SDK_INT < 14) { intent.setAction(Intent.ACTION_DELETE); } else { intent.setAction(Intent.ACTION_UNINSTALL_PACKAGE); intent.putExtra(Intent.EXTRA_RETURN_RESULT, true); } try { startActivityForResult(intent, REQUEST_CODE_UNINSTALL); } catch (ActivityNotFoundException e) { Log.e(TAG, "ActivityNotFoundException", e); installer.sendBroadcastUninstall(packageName, Installer.ACTION_UNINSTALL_INTERRUPTED, "This Android rom does not support ACTION_UNINSTALL_PACKAGE!"); finish(); } }
From source file:com.raspberry.library.util.IntentUtils.java
/** * ??App?// w w w .jav a2 s .c o m * * @param packageName ?? * @return intent */ public static Intent getUninstallAppIntent(String packageName) { Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:" + packageName)); return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); }