|
5 | 5 | import android.content.DialogInterface;
|
6 | 6 | import android.content.Intent;
|
7 | 7 | import android.os.Bundle;
|
8 |
| -import java.io.InputStream; |
9 | 8 |
|
10 | 9 | public class debug extends Activity {
|
11 |
| - String[] exceptionType = { |
12 |
| - "StringIndexOutOfBoundsException", |
13 |
| - "IndexOutOfBoundsException", |
14 |
| - "ArithmeticException", |
15 |
| - "NumberFormatException", |
16 |
| - "ActivityNotFoundException" |
17 |
| - }; |
18 |
| - String[] errMessage= { |
19 |
| - "Invalid string operation\n", |
20 |
| - "Invalid list operation\n", |
21 |
| - "Invalid arithmetical operation\n", |
22 |
| - "Invalid toNumber block operation\n", |
23 |
| - "Invalid intent operation" |
24 |
| - }; |
| 10 | + |
25 | 11 | @Override
|
26 | 12 | protected void onCreate(Bundle savedInstanceState) {
|
27 | 13 | super.onCreate(savedInstanceState);
|
28 | 14 | Intent intent = getIntent();
|
29 |
| - String errMsg = ""; |
30 |
| - String madeErrMsg = ""; |
31 |
| - if(intent != null){ |
32 |
| - errMsg = intent.getStringExtra("error"); |
33 |
| - String[] spilt = errMsg.split("\n"); |
34 |
| - //errMsg = spilt[0]; |
35 |
| - try { |
36 |
| - for (int j = 0; j < exceptionType.length; j++) { |
37 |
| - if (spilt[0].contains(exceptionType[j])) { |
38 |
| - madeErrMsg = errMessage[j]; |
39 |
| - int addIndex = spilt[0].indexOf(exceptionType[j]) + exceptionType[j].length(); |
40 |
| - madeErrMsg += spilt[0].substring(addIndex, spilt[0].length()); |
41 |
| - break; |
42 |
| - } |
43 |
| - } |
44 |
| - if(madeErrMsg.isEmpty()) madeErrMsg = errMsg; |
45 |
| - }catch(Exception e){} |
46 |
| - } |
47 |
| - AlertDialog.Builder bld = new AlertDialog.Builder(this); |
48 |
| - bld.setTitle("An error occured"); |
49 |
| - bld.setMessage( madeErrMsg ); |
50 |
| - bld.setNeutralButton("End Application", new DialogInterface.OnClickListener() { |
51 |
| - @Override |
52 |
| - public void onClick(DialogInterface dialog, int which) { |
53 |
| - finish(); |
54 |
| - } |
55 |
| - }); |
56 |
| - bld.create().show(); |
| 15 | + |
| 16 | + AlertDialog.Builder builder = new AlertDialog.Builder(this); |
| 17 | + builder.setMessage(intent.getStringExtra("error")); |
| 18 | + builder.show(); |
57 | 19 | }
|
58 | 20 | }
|
0 commit comments