Skip to content

Commit 844e795

Browse files
author
River
committed
2 parents 707c911 + 4c374ee commit 844e795

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/org/qpython/sample/MainActivity.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void onQPyExec(View v) {
7373

7474
startActivityForResult(intent, SCRIPT_EXEC_PY);
7575
} else {
76-
Toast.makeText(getApplicationContext(), "Please install QPython Player first", Toast.LENGTH_LONG).show();
76+
Toast.makeText(getApplicationContext(), "Please install QPython first", Toast.LENGTH_LONG).show();
7777

7878
try {
7979
Uri uLink = Uri.parse("market://details?id=com.hipipal.qpyplus");
@@ -91,11 +91,16 @@ public void onQPyExec(View v) {
9191
@Override
9292
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
9393
if (requestCode == SCRIPT_EXEC_PY) {
94-
Bundle bundle = data.getExtras();
95-
String flag = bundle.getString("flag"); // flag you set
96-
String param = bundle.getString("param"); // param you set
97-
String result = bundle.getString("result"); // Result your Pycode generate
98-
Toast.makeText(this, "onQPyExec: return ("+result+")", Toast.LENGTH_SHORT).show();
94+
if (data!=null) {
95+
Bundle bundle = data.getExtras();
96+
String flag = bundle.getString("flag"); // flag you set
97+
String param = bundle.getString("param"); // param you set
98+
String result = bundle.getString("result"); // Result your Pycode generate
99+
Toast.makeText(this, "onQPyExec: return ("+result+")", Toast.LENGTH_SHORT).show();
100+
} else {
101+
Toast.makeText(this, "onQPyExec: data is null", Toast.LENGTH_SHORT).show();
102+
103+
}
99104
}
100105
}
101106

0 commit comments

Comments
 (0)