|
1 | 1 | package me.sheimi.android.utils; |
2 | 2 |
|
| 3 | +import android.content.DialogInterface; |
| 4 | +import android.content.Intent; |
| 5 | +import android.util.Log; |
| 6 | +import android.widget.Toast; |
| 7 | + |
3 | 8 | import java.security.MessageDigest; |
4 | 9 | import java.security.NoSuchAlgorithmException; |
5 | 10 | import java.util.Locale; |
6 | 11 |
|
7 | 12 | import me.sheimi.android.activities.SheimiFragmentActivity; |
| 13 | +import me.sheimi.sgit.R; |
8 | 14 |
|
9 | 15 | import com.nostra13.universalimageloader.core.ImageLoader; |
10 | 16 |
|
@@ -68,8 +74,27 @@ public static void showException(Throwable t) { |
68 | 74 |
|
69 | 75 | public static void showException(Throwable t, int res) { |
70 | 76 | SheimiFragmentActivity activity = BasicFunctions.getActiveActivity(); |
71 | | - activity.showToastMessage(res); |
72 | | - t.printStackTrace(); |
| 77 | + StackTraceElement[] ste = t.getStackTrace(); |
| 78 | + String str = t.getCause().getMessage()+"\n"; |
| 79 | + for (int i=0; i < ste.length; i++){ |
| 80 | + str += ste[i].toString()+"\n"; |
| 81 | + } |
| 82 | + final String str2 = str; |
| 83 | + activity.showMessageDialog(R.string.dialog_show_invalid_remote, str2, R.string.action_send_report, new DialogInterface.OnClickListener() { |
| 84 | + @Override |
| 85 | + public void onClick(DialogInterface dialogInterface, int i) { |
| 86 | + Intent intent = new Intent(Intent.ACTION_SEND); |
| 87 | + intent.setType("message/rfc822"); |
| 88 | + intent.putExtra(Intent.EXTRA_EMAIL , new String[]{getActiveActivity().getString(R.string.report_mail)}); |
| 89 | + intent.putExtra(Intent.EXTRA_SUBJECT, getActiveActivity().getString(R.string.dialog_show_invalid_remote)); |
| 90 | + intent.putExtra(Intent.EXTRA_TEXT, str2); |
| 91 | + try { |
| 92 | + getActiveActivity().startActivity(Intent.createChooser(intent, "Send mail...")); |
| 93 | + } catch (android.content.ActivityNotFoundException ex) { |
| 94 | + Toast.makeText(getActiveActivity(), "There are no email clients installed.", Toast.LENGTH_SHORT).show(); |
| 95 | + } |
| 96 | + } |
| 97 | + }); |
73 | 98 | } |
74 | 99 |
|
75 | 100 | } |
0 commit comments