當前位置: 首頁>>代碼示例>>Java>>正文


Java ActivityNotFoundException.printStackTrace方法代碼示例

本文整理匯總了Java中android.content.ActivityNotFoundException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java ActivityNotFoundException.printStackTrace方法的具體用法?Java ActivityNotFoundException.printStackTrace怎麽用?Java ActivityNotFoundException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.ActivityNotFoundException的用法示例。


在下文中一共展示了ActivityNotFoundException.printStackTrace方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: gotoMarket

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
public static void gotoMarket(Context context, String pkgName, boolean viaBrowser) {
    if (context == null || TextUtils.isEmpty(pkgName)) {
        return;
    }

    // https://play.google.com/store/apps/details?id=%s
    final String LINK = String.format((viaBrowser
            ? "http://www.coolapk.com/apk/%s"
            : "market://details?id=%s"), pkgName);

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(LINK));

    try {
        context.startActivity(intent);
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();

        if (!viaBrowser) {
            gotoMarket(context, pkgName, true);
        }
    }
}
 
開發者ID:by-syk,項目名稱:NanoIconPack,代碼行數:24,代碼來源:ExtraUtil.java

示例2: sendEmail

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
public static void sendEmail(Context context, String email, String content)
{
	try
	{
		Intent intent = new Intent(Intent.ACTION_SEND);
		intent.setType("text/plain");
		intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]
		{
			email
		});
		context.startActivity(intent);
	}
	catch (ActivityNotFoundException e)
	{
		e.printStackTrace();
	}
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:18,代碼來源:TDevice.java

示例3: chatQQ

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
/**
 * qq谘詢
 */
public static boolean chatQQ(Context context, String qq) {
    try {
        if (CmdUtil.checkApkExist(context, "com.tencent.mobileqq")) {
            String url = "mqqwpa://im/chat?chat_type=wpa&uin=" + qq;
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
            return true;
        } else {
            T_.error("您沒有安裝騰訊QQ");
        }
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
        T_.error("您沒有安裝騰訊QQ");
    }
    return false;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:21,代碼來源:RUtils.java

示例4: sendEmail

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
/**
 * 發送郵件
 *
 * @param context
 * @param subject 主題
 * @param content 內容
 * @param emails  郵件地址
 */
public static void sendEmail(Context context, String subject,
                             String content, String... emails) {
    try {
        Intent intent = new Intent(Intent.ACTION_SEND);
        // 模擬器
        // intent.setType("text/plain");
        intent.setType("message/rfc822"); // 真機
        intent.putExtra(Intent.EXTRA_EMAIL, emails);
        intent.putExtra(Intent.EXTRA_SUBJECT, subject);
        intent.putExtra(Intent.EXTRA_TEXT, content);
        context.startActivity(intent);
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
}
 
開發者ID:devzwy,項目名稱:NeiHanDuanZiTV,代碼行數:24,代碼來源:DeviceUtils.java

示例5: onPrimaryClipChanged

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
@Override
public void onPrimaryClipChanged() {
    ClipData clip = mClipboardManager.getPrimaryClip();
    String paste = clip.getItemAt(0).getText().toString();
    if(paste.matches("https://www.instagram.com/p/(.*)")){
        Intent launchIntent = getPackageManager().getLaunchIntentForPackage(getApplicationContext().getPackageName());
        if (launchIntent != null)
        {
            try
            {
                startActivity(launchIntent);
            }
            catch (ActivityNotFoundException ex)
            {
                ex.printStackTrace();
            }
        }
    }
}
 
開發者ID:bachors,項目名稱:Insta-Downloader,代碼行數:20,代碼來源:ClipBoardService.java

示例6: onOpenBrowser

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
private void onOpenBrowser() {
    boolean browserStarted = false;

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {

        /*
         * Apparently some devices do not handle this intent.
         * Fallback to internal browser.
         */
        try {
            Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
            getActivity().startActivityForResult(intent, ReposActivity.ACTION_OPEN_DOCUMENT_TREE_REQUEST_CODE);
            browserStarted = true;

        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
        }
    }

    if (! browserStarted) {
        Activity activity = getActivity();

        if (activity != null) {
            /* Close the keyboard before opening the browser. */
            ActivityUtils.closeSoftKeyboard(getActivity());

            /* Open internal browser. */
            ((CommonActivity) activity).runWithPermission(
                    AppPermissions.Usage.LOCAL_REPO,
                    this::startBrowserDelayed
            );
        }
    }
}
 
開發者ID:orgzly,項目名稱:orgzly-android,代碼行數:35,代碼來源:DirectoryRepoFragment.java

示例7: onTargetNotFound

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
@Override
public boolean onTargetNotFound(
    @NonNull Context context,
    @NonNull Uri uri,
    @NonNull Bundle bundle,
    @Nullable Integer intentFlags) {

    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    intent.putExtras(bundle);
    if (intentFlags != null) {
        intent.setFlags(intentFlags);
    }
    try {
        context.startActivity(intent);
    } catch (ActivityNotFoundException exception) {
        exception.printStackTrace();
        return false;
    }
    return true;
}
 
開發者ID:drakeet,項目名稱:Floo,代碼行數:21,代碼來源:OpenDirectlyHandler.java

示例8: openUrl

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
private void openUrl(String url) {
    try {
        startActivity(new Intent(Intent.ACTION_VIEW,
                Uri.parse(url)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
}
 
開發者ID:iAcn,項目名稱:MBEStyle,代碼行數:9,代碼來源:AboutFragment.java

示例9: shouldOverrideUrlLoading

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {

    if ((url.contains("market://")
            || url.contains("mailto:")
            || url.contains("play.google")
            || url.contains("tel:")
            || url.contains("vid:")
            || url.contains("youtube")) == true) {
        view.getContext().startActivity(
                new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
        return true;
    }
    if ((url.contains("http://") || url.contains("https://"))) {
        return false;
    }

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    try {
        view.getContext().startActivity(intent);
    } catch (ActivityNotFoundException e) {
        Log.e("shouldOverrideUrlLoad", "" + e.getMessage());
        e.printStackTrace();
    }
    return true;

}
 
開發者ID:sfilmak,項目名稱:MakiLite,代碼行數:28,代碼來源:MakiBrowser.java

示例10: startAppMarket

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
/**
 * 打開 app 應用市場,到具體的 app 詳情頁,id= 填寫具體的 app 包名
 *
 * @param context       {@link Context}
 * @param marketPkgName app 應用市場的包名
 */
public static void startAppMarket(Context context, String marketPkgName, String appPkgName) {
    Intent intent = new Intent(Intent.ACTION_VIEW,
            Uri.parse("market://details?id=" + appPkgName));
    intent.setPackage(marketPkgName);
    try {
        context.startActivity(intent);
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
        Log.e(TAG, "打開該應用市場失敗,請選擇其他,謝謝~");
    }
}
 
開發者ID:nukc,項目名稱:AppMarketUpdater,代碼行數:18,代碼來源:AppMarketUpdater.java

示例11: printStackTrace

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
public static void printStackTrace(String TAG, ActivityNotFoundException e) {
	if (IsDebug) {
		e.printStackTrace();
	} else {
		logException(TAG, e);
	}
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:8,代碼來源:Logger.java

示例12: apply2Adw

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
private void apply2Adw() {
    Intent intent = new Intent("org.adw.launcher.SET_THEME");
    intent.putExtra("org.adw.launcher.theme.NAME", getContext().getPackageName());
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {
        getContext().startActivity(intent);
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
}
 
開發者ID:homeii,項目名稱:GxIconDIY,代碼行數:11,代碼來源:ApplyDialog.java

示例13: apply2Smart

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
private void apply2Smart() {
    Intent intent = new Intent("ginlemon.smartlauncher.setGSLTHEME");
    intent.putExtra("package", getContext().getPackageName());
    try {
        getContext().startActivity(intent);
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
}
 
開發者ID:homeii,項目名稱:GxIconDIY,代碼行數:10,代碼來源:ApplyDialog.java

示例14: share

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
private void share() {
	Context mContext = mParent.getContext();
	Intent sendIntent = new Intent();
	sendIntent.setAction(Intent.ACTION_SEND);
	sendIntent.putExtra(Intent.EXTRA_TEXT, mContext.getString(R.string.update_share_text));
	sendIntent.setType("text/plain");

	try {
		mContext.startActivity(sendIntent);
	} catch (ActivityNotFoundException e) {
		e.printStackTrace();
	}
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:14,代碼來源:UpdateDialogHandler.java

示例15: actionView

import android.content.ActivityNotFoundException; //導入方法依賴的package包/類
private void actionView(String url) {
    if (TextUtils.isEmpty(url))
        return;

    try {
        view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
}
 
開發者ID:gejiaheng,項目名稱:Protein,代碼行數:11,代碼來源:UserPresenter.java


注:本文中的android.content.ActivityNotFoundException.printStackTrace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。