diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 4cc9e4c31..af69b040a 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -278,17 +278,17 @@ public class AppContext extends CommonAppContext { Log.e("ApplicationError", "主线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息 e.printStackTrace(); //闪退后finish所有Activity并且杀死进程 - for (WeakReference activity : activities) { + /* for (WeakReference activity : activities) { if (activity != null && activity.get() != null) { activity.get().finish(); } } - /* Process.killProcess(Process.myPid()); - System.exit(0);*/ + *//* Process.killProcess(Process.myPid()); + System.exit(0);*//* setFirebaseCrashData(); new Handler(Looper.getMainLooper()).postDelayed(() -> { throw new RuntimeException(e); - }, 100); + }, 100);*/ }) .setUncaughtCrashHandler((t, e) -> { Log.e("ApplicationError", "子线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息 diff --git a/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java b/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java index f99f3a492..93f23b13b 100644 --- a/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java +++ b/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java @@ -101,10 +101,9 @@ public class NeverCrashUtils { Log.e(TAG, "未捕获的主线程异常行为", e); } e.printStackTrace(); - Toast.makeText(application, "发生闪退", Toast.LENGTH_SHORT).show(); + Toast.makeText(application, "发生闪退:"+e.getMessage(), Toast.LENGTH_SHORT).show(); FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()), throwableToString(e), "error.log"); getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e); - return; } } }); diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java index 4b8688cb1..b1659c847 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java @@ -368,34 +368,10 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement .setOnBannerClickListener(new OnBannerClickListener() { @Override public void onBannerClick(List datas, int p) { - if (true) { - /* System.err.println("cache = " + mContext.getCacheDir().getAbsolutePath()); - String type = "image/*"; - String filename = "/ztest/myPhoto.jpg"; - String mediaPath = Environment.getExternalStorageDirectory() + filename; - // Create the new Intent using the 'Send' action. - Intent share = new Intent(Intent.ACTION_SEND); - - // Set the MIME type - share.setType(type); - - // Create the URI from the media - File media = new File(mediaPath); - Uri uri = FileProvider.getUriForFile(mContext, - mContext.getPackageName() + ".fileprovider", - media - ); - - // Add the URI to the Intent. - share.putExtra(Intent.EXTRA_STREAM, uri); - share.putExtra(Intent.EXTRA_TEXT, "test"); - // Broadcast the Intent. - // share.setPackage("com.whatsapp"); //WhatsApp - - // share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=test")); //Line - mContext.startActivity(Intent.createChooser(share, "Share to"));*/ - mContext.startActivity(new Intent(mContext, TestActivity.class)); - return; + if (false) { + throw new NullPointerException("空指针测试异常"); + // mContext.startActivity(new Intent(mContext, TestActivity.class)); + //return; } if (mBannerList != null) { if (p >= 0 && p < mBannerList.size()) {