本文整理汇总了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);
}
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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();
}
}
}
}
示例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
);
}
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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, "打开该应用市场失败,请选择其他,谢谢~");
}
}
示例11: printStackTrace
import android.content.ActivityNotFoundException; //导入方法依赖的package包/类
public static void printStackTrace(String TAG, ActivityNotFoundException e) {
if (IsDebug) {
e.printStackTrace();
} else {
logException(TAG, e);
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}