本文整理匯總了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();
}
}