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.FragmentExtras.java

private void actExtras2() {
    Uri extras2uriString = Uri.parse(getString(R.string.extras2_link)); //use this to link to your UCCW skins on Play or Website
    Intent extras2Intent = new Intent("android.intent.action.VIEW", extras2uriString);
    try {/*from   w w  w .jav  a2  s.  c o m*/
        startActivity(extras2Intent);
    } catch (ActivityNotFoundException e2) {
        e2.printStackTrace();
    }

}

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

private void actPlay() {
    Uri marketuriString = Uri.parse(getString(R.string.play_link));
    Intent playintent = new Intent(Intent.ACTION_VIEW, marketuriString);
    try {//  w w  w .  j a v a  2 s  .  co m
        startActivity(playintent);
    } catch (ActivityNotFoundException e2) {
        e2.printStackTrace();
        Toast.makeText(getActivity().getApplicationContext(), "Play Store not found!", Toast.LENGTH_LONG)
                .show();
    }
}

From source file:com.example.discoveryagentrest.Notification.java

@Get
public void doGet() {
    try {//  w  w  w.j  a v a 2  s. c om
        Log.d("MyApp", "Get Notification");
        if (getReference().getRemainingPart().contains("url=")) {
            String url = getValue("url=");
            int min = 0;
            int max = 1000000000;

            Random r = new Random();
            int value = r.nextInt(max - min + 1) + min;

            if (!url.startsWith("http://") && !url.startsWith("https://"))
                url = "http://" + url;

            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

            PendingIntent intent = PendingIntent.getActivity(com.example.discoveryagentrest.ServiceBoot.context,
                    0, browserIntent, PendingIntent.FLAG_UPDATE_CURRENT);

            NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
                    com.example.discoveryagentrest.ServiceBoot.context).setSmallIcon(R.drawable.mediascape)
                            .setContentIntent(intent).setContentTitle("Mediascape").setContentText(url)
                            .setAutoCancel(true);

            NotificationManager mNotificationManager = (NotificationManager) com.example.discoveryagentrest.ServiceBoot.context
                    .getSystemService(Context.NOTIFICATION_SERVICE);
            mNotificationManager.notify(value, mBuilder.build());
        }
    } catch (ActivityNotFoundException e) {
        Log.d("MyApp", "No application can handle this request." + " Please install a webbrowser");
        e.printStackTrace();
    }
}

From source file:tk.android.client.activity.Activity_client.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.button_version: {
        try {//w w w  . ja  v  a2s .  com
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(PLAY_STORE_URL)));
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
        }
        break;
    }
    case R.id.layout_support: {
        startActivity(new Intent(activity, Activity_user.class)
                .setData(Uri.parse("https://twitter.com/OrangeSphereApp")));
        break;
    }
    case R.id.layout_pro: {
        if (PropertyManager.getInstance().isProUser()) {
            Toast.makeText(activity, "You alreadry Pro User :)", Toast.LENGTH_SHORT).show();
            break;
        }
        String TAG = "EditDialog-Pro";
        final EditDialog dialog = new EditDialog();
        dialog.newInstance(activity);
        dialog.setTitle(R.string.advertisement);
        dialog.setOnFinishEditListener(new OnFinishEditListener() {

            @Override
            public void onFinishEdit(final String text) {
                int length = text.length();
                if (length > 100 || length == 0) {
                    Toast.makeText(activity, R.string.bad_string_length, Toast.LENGTH_SHORT).show();
                    return;
                }
                dialog.dismiss();
                new Thread(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            Twitter twitter = core.getTwitter();
                            if (twitter == null) {
                                throw new Exception();
                            }
                            twitter.updateStatus(text + " " + PLAY_STORE_URL + " #OrangeSphere");
                            PropertyManager.getInstance().toBeProUser();
                            SQLiteManager manager = new SQLiteManager(activity);
                            SQLiteDatabase db = manager.getWritableDatabase();
                            ContentValues values = new ContentValues();
                            values.put("client_name", "OrangeSpherePro");
                            values.put("consumer_key", "b1NEqKgA8CGudo6yhkg");
                            values.put("consumer_secret", "awqnQwi3BXUqkyjlMZHlDIvad3bV3cVO03MxRTV4s");
                            db.insert("client_table", null, values);
                            db.close();
                            new UiHandler() {

                                @Override
                                public void run() {
                                    Toast.makeText(activity, R.string.be_pro_user, Toast.LENGTH_SHORT).show();
                                }

                            }.post();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }

                }).start();
            }

        });
        dialog.show(getSupportFragmentManager(), TAG);
        break;
    }
    case R.id.layout_license: {
        new LicenseDialog().show(getSupportFragmentManager(), "LicenseDialog");
        break;
    }
    }
}

From source file:com.example.captain_miao.grantap.ShadowPermissionActivity.java

public void showPermissionDenyDialog(final ArrayList<String> deniedPermissions) {

    if (TextUtils.isEmpty(denyMessage)) {
        // denyMessage
        permissionDenied(deniedPermissions);
        return;/*  w  ww  . j  av  a 2 s.co  m*/
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(denyMessage).setCancelable(false).setNegativeButton(deniedCloseButtonText,
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    permissionDenied(deniedPermissions);
                }
            });

    if (hasSettingButton) {

        builder.setPositiveButton(settingButtonText, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {

                try {
                    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
                            .setData(Uri.parse("package:" + packageName));
                    startActivityForResult(intent, REQ_CODE_REQUEST_SETTING);
                } catch (ActivityNotFoundException e) {
                    e.printStackTrace();
                    Intent intent = new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
                    startActivityForResult(intent, REQ_CODE_REQUEST_SETTING);
                }

            }
        });

    }
    builder.show();
}

From source file:com.hmatalonga.greenhub.ui.MainActivity.java

@Override
public boolean onMenuItemClick(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.action_inbox:
        startActivity(new Intent(this, InboxActivity.class));
        return true;
    case R.id.action_summary:
        try {// w w  w.j  a va  2 s .  c  o m
            Intent powerSummary = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
            ResolveInfo resolveInfo = getPackageManager().resolveActivity(powerSummary, 0);
            if (resolveInfo != null) {
                startActivity(powerSummary);
            }
            // TODO: else show dialog
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
        }
        return true;
    case R.id.action_settings:
        Answers.getInstance().logContentView(new ContentViewEvent().putContentName("Enters settings page")
                .putContentType("Page visit").putContentId("page-settings"));
        startActivity(new Intent(this, SettingsActivity.class));
        return true;
    case R.id.action_rating:
        Answers.getInstance()
                .logContentView(new ContentViewEvent().putContentName("Enters Google Play Store to rate")
                        .putContentType("Page visit").putContentId("page-store"));
        try {
            startActivity(
                    new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.hmatalonga.greenhub")));
        } catch (ActivityNotFoundException e) {
            startActivity(new Intent(Intent.ACTION_VIEW,
                    Uri.parse("http://play.google.com/store/apps/details?id=com.hmatalonga.greenhub")));
        }
        return true;
    }

    return false;
}

From source file:io.github.marktony.espresso.mvp.addpackage.AddPackageFragment.java

/**
 * Launch the camera/*from   w  w  w  . ja  va 2s  . com*/
 */
private void startScanningActivity() {
    try {
        Intent intent = new Intent(getContext(), CaptureActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivityForResult(intent, SCANNING_REQUEST_CODE);
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
}

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

private void applyAviateTheme() {
    Intent intent = new Intent("com.tul.aviate.SET_THEME");
    intent.putExtra("THEME_PACKAGE", getActivity().getPackageName());
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {/* w ww .j  a  v  a2 s  .  co  m*/
        startActivity(intent);
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
        makeToast("Aviate is not installed!");
    }
}

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

private void applyAdwTheme() {
    try {//from  w  ww. j  av a2 s . c  o  m
        Intent adwlauncherIntent = new Intent(Intent.ACTION_MAIN);
        adwlauncherIntent.setComponent(new ComponentName("org.adw.launcher", "org.adw.launcher.Launcher"));
        startActivity(adwlauncherIntent);
        makeToast("Apply with \"ADW Settings\" in Menu");
    } catch (ActivityNotFoundException e4) {
        e4.printStackTrace();
        makeToast("ADW Launcher is not installed!");
    }

}

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

private void applyAdwExTheme() {
    try {//w ww  . j  av a2  s .co  m
        Intent adwexlauncherIntent = new Intent("org.adw.launcher.SET_THEME");
        adwexlauncherIntent.putExtra("org.adw.launcher.theme.NAME", getActivity().getPackageName());
        startActivity(Intent.createChooser(adwexlauncherIntent, "ADW Not Installed"));
    } catch (ActivityNotFoundException e5) {
        e5.printStackTrace();
        makeToast("ADW EX is not installed!");
        applyAdwTheme();
    }
    //finish();
}