Example usage for android.content ActivityNotFoundException printStackTrace

List of usage examples for android.content ActivityNotFoundException printStackTrace

Introduction

In this page you can find the example usage for android.content ActivityNotFoundException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.chale22.ico01.fragments.FragmentTheme.java

private void applyApexTheme() {
    final String ACTION_SET_THEME = "com.anddoes.launcher.SET_THEME";
    final String EXTRA_PACKAGE_NAME = "com.anddoes.launcher.THEME_PACKAGE_NAME";

    Intent apexlauncherIntent = new Intent(ACTION_SET_THEME);
    apexlauncherIntent.putExtra(EXTRA_PACKAGE_NAME, getActivity().getPackageName());
    apexlauncherIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {// w w w  .  j a v a2 s. c o  m
        startActivity(apexlauncherIntent);
    } catch (ActivityNotFoundException e3) {
        e3.printStackTrace();
        makeToast("Apex Launcher is not installed!");
    }
    //finish();
}

From source file:com.chale22.ico01.fragments.FragmentTheme.java

private void applyNovaTheme() {
    WallpaperManager setDefaultWallpaper = WallpaperManager.getInstance(getActivity().getApplicationContext());
    try {/* w ww .  j a  va2  s.c  o m*/
        Intent novalauncherIntent = new Intent(ACTION_APPLY_ICON_THEME);
        novalauncherIntent.setPackage(NOVA_PACKAGE);
        novalauncherIntent.putExtra(EXTRA_ICON_THEME_TYPE, "GO");
        novalauncherIntent.putExtra(EXTRA_ICON_THEME_PACKAGE, getActivity().getPackageName());
        startActivity(novalauncherIntent);

    } catch (ActivityNotFoundException e3) {
        e3.printStackTrace();
        makeToast("Nova Launcher is not installed!");
    }
    //finish();
}

From source file:com.chale22.ico01.fragments.FragmentTheme.java

private void applyActionLauncherTheme() {
    try {/*  www  .j a va2  s  .co  m*/
        Intent actionlauncherIntent = getActivity().getPackageManager()
                .getLaunchIntentForPackage("com.actionlauncher.playstore");
        if (actionlauncherIntent != null) {
            // TODO BY YOU: set this package name as appropriate. Eg "kov.theme.stark"
            actionlauncherIntent.putExtra("apply_icon_pack", getActivity().getPackageName());
            startActivity(actionlauncherIntent); // Action Launcher will take it from here...
        } else {
            // Direct users to get Action Launcher Pro
            String playStoreUrl = "https://play.google.com/store/apps/details?id=com.chrislacy.actionlauncher.pro";
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(playStoreUrl)));
        }
    } catch (ActivityNotFoundException e7) {
        e7.printStackTrace();
        makeToast("Action Launcher is not installed!");
    }
    //finish();
}

From source file:com.chale22.ico01.fragments.FragmentTheme.java

private void applyGoTheme() {
    try {/*from ww  w  .  jav  a2  s  . c o  m*/
        Intent go = getActivity().getPackageManager().getLaunchIntentForPackage("com.gau.go.launcherex");
        if (go != null) {
            Intent golauncher = new Intent(ACTION_MYTHEME);
            golauncher.putExtra("type", 1);
            golauncher.putExtra("pkgname", getActivity().getPackageName());
            getActivity().sendBroadcast(golauncher);
            Toast appliedGo = Toast.makeText(getActivity().getBaseContext(),
                    getResources().getString(R.string.go_applied), Toast.LENGTH_LONG);
            appliedGo.show();
        } else {
            // Direct users to get Go Launcher
            String playStoreUrl = "https://play.google.com/store/apps/details?id=com.gau.go.launcherex";
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(playStoreUrl)));
        }
    } catch (ActivityNotFoundException e7) {
        e7.printStackTrace();
        makeToast("Go is not installed!");
    }
    //finish();
}

From source file:org.geometerplus.fbreader.plugin.local_opds_scanner.ScanLocalNetworkActivity.java

@Override
protected void onListItemClick(ListView parent, View view, int position, long id) {
    final Item item = getListAdapter().getItem(position);
    if (item instanceof ServiceInfoItem) {
        try {// www. j a va 2  s.c  o  m
            startActivity(new Intent("android.fbreader.action.ADD_OPDS_CATALOG_URL")
                    .setData(((ServiceInfoItem) item).URI).putExtra("type", 2));
            finish();
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.chale22.ico01.fragments.FragmentTheme.java

private void applyHolohdTheme() {
    try {/*from   ww  w.  ja  va2 s  .  co  m*/
        if (getActivity().getPackageManager().getLaunchIntentForPackage("com.mobint.hololauncher") != null) {
            Toast.makeText(getActivity().getBaseContext(), getResources().getString(R.string.holo),
                    Toast.LENGTH_SHORT);
        } else {
            makeToast("Holo Launcher HD is not installed!");
            startActivity(new Intent("android.intent.action.VIEW",
                    Uri.parse("https://play.google.com/store/apps/details?id=com.mobint.hololauncher.hd")));
        }
    } catch (ActivityNotFoundException localActivityNotFoundException) {
        localActivityNotFoundException.printStackTrace();
    }
}

From source file:com.chale22.ico01.fragments.FragmentTheme.java

private void applyMiniTheme() {
    try {/*from www  .j a  v a2s  .co  m*/
        if (getActivity().getPackageManager()
                .getLaunchIntentForPackage("com.jiubang.go.mini.launcher") != null) {
            Toast.makeText(getActivity().getBaseContext(), getResources().getString(R.string.minilauncher),
                    Toast.LENGTH_SHORT);
        } else {
            makeToast("Mini Launcher is not installed!");
            startActivity(new Intent("android.intent.action.VIEW",
                    Uri.parse("https://play.google.com/store/apps/details?id=com.jiubang.go.mini.launcher")));
        }
    } catch (ActivityNotFoundException localActivityNotFoundException) {
        localActivityNotFoundException.printStackTrace();
    }
}

From source file:com.chale22.ico01.fragments.FragmentTheme.java

private void applyNextTheme() {
    try {/*from   w  w w  . j  a  v a  2s .c  o  m*/
        Intent localIntent1 = getActivity().getPackageManager()
                .getLaunchIntentForPackage("com.gtp.nextlauncher");
        if (getActivity().getPackageManager().getLaunchIntentForPackage("com.gtp.nextlauncher.trial") != null) {
            Intent localIntent2 = new Intent("com.gau.go.launcherex.MyThemes.mythemeaction");
            localIntent2.putExtra("type", 1);
            localIntent2.putExtra("pkgname", getActivity().getPackageName());
            getActivity().sendBroadcast(localIntent2);
            Toast.makeText(getActivity().getBaseContext(), getResources().getString(2131230794), 1).show();
        } else if (localIntent1 != null) {
            Intent localIntent3 = new Intent("com.gau.go.launcherex.MyThemes.mythemeaction");
            localIntent3.putExtra("type", 1);
            localIntent3.putExtra("pkgname", getActivity().getPackageName());
            getActivity().sendBroadcast(localIntent3);
            Toast.makeText(getActivity().getBaseContext(), getResources().getString(R.string.nextlauncher),
                    Toast.LENGTH_SHORT);
        }
    } catch (ActivityNotFoundException localActivityNotFoundException) {
        localActivityNotFoundException.printStackTrace();
    }
    makeToast("Next Launcher is not installed!");
    startActivity(new Intent("android.intent.action.VIEW",
            Uri.parse("https://play.google.com/store/apps/details?id=com.gtp.nextlauncher.trial")));
}

From source file:com.example.android.wardrobe.HomeActivity.java

public void loadImage(final int what) {
    ContextOption[] items = new ContextOption[] {
            new ContextOption("Take picture from camera", R.drawable.camera),
            new ContextOption("Select picture from gallery", R.drawable.gallery) };
    SimpleMenuAdapter contextMenuAdapter = new SimpleMenuAdapter(this, Arrays.asList(items));
    new AlertDialog.Builder(this)
            // .setTitle("Share Appliction")
            .setAdapter(contextMenuAdapter, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int menuId) {
                    Intent intent = null;
                    switch (menuId) {
                    case 0:
                        addWhat = what;//from  w ww  .ja va2 s .  c  o m
                        intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

                        mImageCaptureUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory(),
                                "tmp_avatar_" + String.valueOf(System.currentTimeMillis()) + ".png"));

                        intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageCaptureUri);
                        intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.name());

                        try {
                            intent.putExtra("return-data", true);

                            startActivityForResult(intent, PICK_FROM_CAMERA);
                        } catch (ActivityNotFoundException e) {
                            e.printStackTrace();
                            /**
                            * TODO show message to user
                            */
                        }
                        break;
                    case 1:
                        addWhat = what;
                        intent = new Intent();

                        intent.setType("image/*");
                        intent.setAction(Intent.ACTION_GET_CONTENT);

                        startActivityForResult(Intent.createChooser(intent, "Complete action using"),
                                PICK_FROM_FILE);
                        break;
                    }
                }
            }).show();
}

From source file:li.barter.fragments.EditProfileFragment.java

@Override
public void onDialogClick(final DialogInterface dialog, final int which) {

    if ((mChoosePictureDialogFragment != null) && mChoosePictureDialogFragment.getDialog().equals(dialog)) {

        if (which == 0) { // Pick from camera
            final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, mCameraImageCaptureUri);

            try {
                startActivityForResult(Intent.createChooser(intent, getString(R.string.complete_action_using)),
                        PICK_FROM_CAMERA);
            } catch (final ActivityNotFoundException e) {
                e.printStackTrace();
            }/*from w  ww  .  ja v a2 s  . c o  m*/

        } else if (which == 1) { // pick from file
            final Intent intent = new Intent();
            intent.setType("image/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);
            startActivityForResult(Intent.createChooser(intent, getString(R.string.complete_action_using)),
                    PICK_FROM_FILE);
        }
    } else {
        super.onDialogClick(dialog, which);
    }
}