microsoft / Cognitive-Face-Android

Cognitive Services Face client library for Android.
https://www.microsoft.com/cognitive-services/en-us/face-api
Other
269 stars 151 forks source link

AddFaceToPersonActivity: AsyncTask executed in onResume #25

Closed JunjieCheng closed 6 years ago

JunjieCheng commented 6 years ago

In the Sample code AddFaceToPersonActivity, I saw that DetectionTask is executed in onResume but not onCreate. I can't understand how does it work. Can you please help me?

`@Override protected void onResume() { super.onResume();

    Uri imageUri = Uri.parse(mImageUriStr);
    mBitmap = ImageHelper.loadSizeLimitedBitmapFromUri(
            imageUri, getContentResolver());
    if (mBitmap != null) {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
        InputStream imageInputStream = new ByteArrayInputStream(stream.toByteArray());
        addLog("Request: Detecting " + mImageUriStr);
        new DetectionTask().execute(imageInputStream);
    }
}`
huxuan commented 6 years ago

I do not think there is any specific reason to do that. The sample aims to be a showcase for the usage of Face API Android SDK, there is no special design and the quality may not be so mature. As this is more like an Android specific problem, I will close this issue.