Skip to content

Commit 03efc32

Browse files
authored
Fix android demo app java build
Fix java build
1 parent b3f97aa commit 03efc32

File tree

1 file changed

+5
-22
lines changed
  • examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo

1 file changed

+5
-22
lines changed

examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/MainActivity.java

+5-22
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,7 @@ protected void onCreate(Bundle savedInstanceState) {
9797
finish();
9898
}
9999

100-
try {
101-
mModule = Module.load("/data/local/tmp/dl3_xnnpack_fp32.pte");
102-
103-
} catch (IOException e) {
104-
Log.e("ImageSegmentation", "Error reading assets", e);
105-
finish();
106-
}
100+
mModule = Module.load("/data/local/tmp/dl3_xnnpack_fp32.pte");
107101

108102
mImageView = findViewById(R.id.imageView);
109103
mImageView.setImageBitmap(mBitmap);
@@ -129,14 +123,8 @@ public void onClick(View v) {
129123
mButtonXnnpack.setOnClickListener(
130124
new View.OnClickListener() {
131125
public void onClick(View v) {
132-
try {
133-
mModule.destroy();
134-
mModule = Module.load("/data/local/tmp/dl3_xnnpack_fp32.pte");
135-
} catch (IOException e) {
136-
Log.e("ImageSegmentation", "Error reading assets", e);
137-
finish();
138-
}
139-
126+
mModule.destroy();
127+
mModule = Module.load("/data/local/tmp/dl3_xnnpack_fp32.pte");
140128
mButtonXnnpack.setEnabled(false);
141129
mProgressBar.setVisibility(ProgressBar.VISIBLE);
142130
mButtonXnnpack.setText(getString(R.string.run_model));
@@ -149,13 +137,8 @@ public void onClick(View v) {
149137
mButtonHtp.setOnClickListener(
150138
new View.OnClickListener() {
151139
public void onClick(View v) {
152-
try {
153-
mModule.destroy();
154-
mModule = Module.load("/data/local/tmp/dlv3_qnn.pte");
155-
} catch (IOException e) {
156-
Log.e("ImageSegmentation", "Error reading assets", e);
157-
finish();
158-
}
140+
mModule.destroy();
141+
mModule = Module.load("/data/local/tmp/dlv3_qnn.pte");
159142
mButtonHtp.setEnabled(false);
160143
mProgressBar.setVisibility(ProgressBar.VISIBLE);
161144
mButtonHtp.setText(getString(R.string.run_model));

0 commit comments

Comments
 (0)