当前位置: 首页>>代码示例>>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;未经允许,请勿转载。