Example usage for android.content ActivityNotFoundException getMessage

List of usage examples for android.content ActivityNotFoundException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:br.com.anteros.vendas.gui.AnexoCadastroActivity.java

/**
 * Abre o anexo pela URI do arquivo anexado para visualizao.
 * @param mUri//w  w w  .j a  v a  2 s .  c  o  m
 */
private void abrirAnexo(Uri mUri) {
    String extension = FilenameUtils.getExtension(AndroidFileUtils.getPath(AnexoCadastroActivity.this, mUri));
    try {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        MimeTypeMap mime = MimeTypeMap.getSingleton();

        String type = mime.getMimeTypeFromExtension(extension);

        intent.setAction(Intent.ACTION_VIEW);
        intent.setDataAndType(mUri, type);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        getApplicationContext().startActivity(intent);

    } catch (ActivityNotFoundException e) {
        new ErrorAlert(AnexoCadastroActivity.this, getResources().getString(R.string.app_name),
                "No foi encontrado nenhum aplicativo nesse aparelho que suporte abrir a extenso '"
                        + extension
                        + "', entre em contato com a equipe de Suporte para resolver esse problema.").show();
    } catch (Exception e) {
        new ErrorAlert(AnexoCadastroActivity.this, getResources().getString(R.string.app_name),
                "No foi possvel abrir o anexo " + anexo.getId() + ". " + e.getMessage()).show();
        e.printStackTrace();
    }
}

From source file:org.thoughtcrime.securesms.ProfileFragment.java

private void fireIntent(Slide slide) {
    if (slide != null) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        intent.setDataAndType(PartAuthority.getPublicPartUri(slide.getUri()), slide.getContentType());
        try {// w  ww.  j  a  v  a 2 s  . c  o m
            getActivity().startActivity(intent);
        } catch (ActivityNotFoundException anfe) {
            Log.w("GDATA", anfe.getMessage() + " - " + slide.getContentType());
        }
    }
}

From source file:jp.mixi.android.sdk.MixiContainerImpl.java

private boolean startSingleSignOn(Activity activity, int activityCode, String[] permissions) {
    // ?????intent????
    Intent intent = new Intent();
    intent.putExtra("mode", "authorize");
    intent.setClassName(OFFICIAL_PACKAGE, AUTH_ACTIVITY);
    intent.putExtra(CLIENT_ID, mClientId);
    // ??/*from  ww w. j  a  v a2  s.  co m*/
    if (permissions != null && permissions.length > 0) {
        intent.putExtra("scope", TextUtils.join(" ", permissions));
    }
    // state?
    intent.putExtra(STATE, String.valueOf(new Random().nextLong() >>> 1));

    if (!validateOfficialAppsForIntent(activity, intent, VALIDATE_OFFICIAL_FOR_ACTIVITY, SUPPORTED_VERSION)) {
        return false;
    }

    try {
        activity.startActivityForResult(intent, activityCode);
    } catch (ActivityNotFoundException e) {
        Log.v(TAG, e.getMessage());
        return false;
    }
    return true;
}

From source file:jp.mixi.android.sdk.MixiContainerImpl.java

@Override
public void requestPayment(final Activity activity, final PaymentParameter param, final int activityCode,
        final CallbackListener listener) {
    mPaymentCallbackListener = listener;
    mPaymentRequestCode = activityCode;//  w  w  w. j a v  a2 s .  com
    if (!validatePaymentParam(param)) {
        listener.onError(new ErrorInfo("parameter invalid", ErrorInfo.OTHER_ERROR));
        return;
    }

    Intent intent = new Intent();
    intent.setClassName(OFFICIAL_PACKAGE, PAYMENT_ACTIVITY);
    intent.putExtras(convertPaymentBundle(param));
    if (!validateOfficialAppsForIntent(activity, intent, VALIDATE_OFFICIAL_FOR_ACTIVITY,
            PAYMENT_SUPPORTED_VERSION)) {
        listener.onFatal(new ErrorInfo(activity.getString(R.string.err_unsupported_versions),
                ErrorInfo.OFFICIAL_APP_NOT_FOUND));

        return;
    }
    try {
        activity.startActivityForResult(intent, activityCode);
    } catch (ActivityNotFoundException e) {
        Log.v(TAG, e.getMessage());
        listener.onFatal(new ErrorInfo(e));
    }

}

From source file:com.inmobi.rendering.RenderView.java

public void m1956b(String str, String str2, String str3) {
    try {/*from  w w w  .  j  av  a  2  s  .c o  m*/
        Intent parseUri = Intent.parseUri(str3, 0);
        parseUri.setFlags(268435456);
        getContext().startActivity(parseUri);
        getListener().m1907g(this);
        m1946a(str2, "broadcastEvent('" + str + "Successful','" + str3 + "');");
    } catch (URISyntaxException e) {
        m1949a(str2, "Cannot resolve URI (" + str3 + ")", str);
        Logger.m1744a(InternalLogLevel.INTERNAL, f1748a,
                "Error message in processing openExternal: " + e.getMessage());
    } catch (ActivityNotFoundException e2) {
        m1949a(str2, "No app can handle the URI (" + str3 + ")", str);
        Logger.m1744a(InternalLogLevel.INTERNAL, f1748a,
                "Error message in processing openExternal: " + e2.getMessage());
    }
}

From source file:org.botlibre.sdk.activity.ChatActivity.java

@TargetApi(23)
private void beginListening() {
    lastReply = System.currentTimeMillis();
    setStreamVolume();/*ww  w .  j av a2s  . c o m*/
    debug("beginListening:");

    try {
        if (!MainActivity.handsFreeSpeech) {
            return;
        }
        if (MainActivity.handsFreeSpeech) {
            muteMicBeep(true);
            isListening = true;
        }

        if (!MainActivity.listenInBackground) {
            muteMicBeep(false);
            return;
        }

    } catch (Exception ignore) {
        Log.e("Error", "BeginListening");
    }

    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    if (MainActivity.offlineSpeech) {
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, MainActivity.voice.language);

        if (!this.failedOfflineLanguage) {
            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US");
            // intent.putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true);
        }
        intent.putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true);
    } else {
        if (MainActivity.voice.language != null && !MainActivity.voice.language.isEmpty()) {
            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, MainActivity.voice.language);
            if (!this.failedOfflineLanguage) {
                intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, MainActivity.voice.language);
            }
        } else {
            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en");
            if (!this.failedOfflineLanguage) {
                intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en");
            }
        }
    }

    try {
        Log.d("BeginListening", "StartListening");
        this.speech.startListening(intent);
        setMicIcon(true, false);
    } catch (ActivityNotFoundException a) {
        Log.d("BeginListening", "CatchError: " + a.getMessage());
        Toast t = Toast.makeText(getApplicationContext(), "Your device doesn't support Speech to Text",
                Toast.LENGTH_SHORT);
        t.show();
    }
}

From source file:org.mdc.chess.MDChess.java

private void getFen() {
    Intent i = new Intent(Intent.ACTION_GET_CONTENT);
    i.setType("application/x-chess-fen");
    try {//from w w w  .j ava 2 s .c  om
        startActivityForResult(i, RESULT_GET_FEN);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
    }
}

From source file:org.mdc.chess.MDChess.java

private void selectScidFile() {
    setAutoMode(AutoMode.OFF);/*w ww.  ja v a  2  s  .  c  o m*/
    Intent intent = new Intent();
    intent.setComponent(new ComponentName("org.scid.android", "org.scid.android.SelectFileActivity"));
    intent.setAction(".si4");
    try {
        startActivityForResult(intent, RESULT_SELECT_SCID);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
    }
}

From source file:org.petero.droidfish.DroidFish.java

private final void selectScidFile() {
    setAutoMode(AutoMode.OFF);/*from w  ww.jav a 2  s .  c o m*/
    Intent intent = new Intent();
    intent.setComponent(new ComponentName("org.scid.android", "org.scid.android.SelectFileActivity"));
    intent.setAction(".si4");
    try {
        startActivityForResult(intent, RESULT_SELECT_SCID);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
    }
}

From source file:edu.mit.viral.shen.DroidFish.java

private final void getFen() {
    Intent i = new Intent(Intent.ACTION_GET_CONTENT);
    i.setType("application/x-chess-fen");
    try {//  w  w w  . ja v a  2  s.  c om
        startActivityForResult(i, RESULT_GET_FEN);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
    }
}