Skip to content

Commit 9780330

Browse files
committed
feat: make debug activity simpler; display only a message on debug dialog
1 parent ccb0754 commit 9780330

File tree

2 files changed

+5
-43
lines changed

2 files changed

+5
-43
lines changed

app/src/main/java/imo/nuts/debug.java

+5-43
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,16 @@
55
import android.content.DialogInterface;
66
import android.content.Intent;
77
import android.os.Bundle;
8-
import java.io.InputStream;
98

109
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+
2511
@Override
2612
protected void onCreate(Bundle savedInstanceState) {
2713
super.onCreate(savedInstanceState);
2814
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();
5719
}
5820
}

assets/app.apk

6 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)