fix crash (exceute NetworkThread on separate intances every time), refs #9991
This commit is contained in:
@@ -244,7 +244,6 @@ public abstract class AbstractScannerActivity extends AppCompatActivity {
|
|||||||
+ url + ", appToken " + appToken + ", token " + token);
|
+ url + ", appToken " + appToken + ", token " + token);
|
||||||
|
|
||||||
apiClient = new ApiClient(url, appToken, token);
|
apiClient = new ApiClient(url, appToken, token);
|
||||||
networkThread = new NetworkThread(this, apiClient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -256,9 +255,8 @@ public abstract class AbstractScannerActivity extends AppCompatActivity {
|
|||||||
*/
|
*/
|
||||||
public void handleBarcode(final @NonNull String card) {
|
public void handleBarcode(final @NonNull String card) {
|
||||||
Log.d(TAG, "handleBarcode");
|
Log.d(TAG, "handleBarcode");
|
||||||
if (BuildConfig.DEBUG) {
|
|
||||||
Toast.makeText(this, card, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, card, Toast.LENGTH_SHORT).show();
|
||||||
}
|
networkThread = new NetworkThread(this, apiClient);
|
||||||
networkThread.card(card).start();
|
networkThread.card(card).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,6 +270,10 @@ public abstract class AbstractScannerActivity extends AppCompatActivity {
|
|||||||
setResult(RESULT_OK, intent);
|
setResult(RESULT_OK, intent);
|
||||||
networkThread.close();
|
networkThread.close();
|
||||||
finish();
|
finish();
|
||||||
|
} else {
|
||||||
|
if (null != result.second) {
|
||||||
|
Toast.makeText(this, result.second, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user