<p dir="auto"><strong>Glide Version</strong>: 4.6.0<br>
<strong>Integration libraries</strong>: okhttp3-3.9.1</p>
<p dir="auto">Update to 4.6.0, I got this issue.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Error:(10, 2) error: incompatible types: GlideModule cannot be converted to Annotation @GlideModule()  ^"><pre class="notranslate"><code class="notranslate">Error:(10, 2) error: incompatible types: GlideModule cannot be converted to Annotation @GlideModule()  ^
</code></pre></div>
<p dir="auto">My Project used exteneded 'AppGlideModule' class.</p>
<p dir="auto"><strong>What can I do this situation?</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import android.content.Context
import com.bumptech.glide.GlideBuilder
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.load.engine.cache.ExternalCacheDiskCacheFactory
import com.bumptech.glide.load.engine.cache.LruResourceCache
import com.bumptech.glide.module.AppGlideModule

@GlideModule
class GlideModule : AppGlideModule(){
    override fun applyOptions(context: Context, builder: GlideBuilder) {
        builder.setDiskCache(ExternalCacheDiskCacheFactory(context, &quot;cache&quot;, DISK_CACHE_SIZE))
                .setMemoryCache(LruResourceCache(cacheSize.toLong()))
    }

    override fun isManifestParsingEnabled(): Boolean {
        return false
    }

    companion object {
        private val maxMemory = (Runtime.getRuntime().maxMemory() / 1024).toInt()
        private val cacheSize = maxMemory / 8
        private val DISK_CACHE_SIZE = 1024 * 1024 * 10
    }
}"><pre class="notranslate"><code class="notranslate">import android.content.Context
import com.bumptech.glide.GlideBuilder
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.load.engine.cache.ExternalCacheDiskCacheFactory
import com.bumptech.glide.load.engine.cache.LruResourceCache
import com.bumptech.glide.module.AppGlideModule

@GlideModule
class GlideModule : AppGlideModule(){
    override fun applyOptions(context: Context, builder: GlideBuilder) {
        builder.setDiskCache(ExternalCacheDiskCacheFactory(context, "cache", DISK_CACHE_SIZE))
                .setMemoryCache(LruResourceCache(cacheSize.toLong()))
    }

    override fun isManifestParsingEnabled(): Boolean {
        return false
    }

    companion object {
        private val maxMemory = (Runtime.getRuntime().maxMemory() / 1024).toInt()
        private val cacheSize = maxMemory / 8
        private val DISK_CACHE_SIZE = 1024 * 1024 * 10
    }
}
</code></pre></div>
<p dir="auto">Hi, we had issue on android where when taking pictures and saving the image, and sending it to our server, image is flipped on android, ios and web applications that we use to view the image. So we tried simple target with glide in hopes that when saving the image locally before sending to server, glide would work its magic and image would be in correct orienation. This does not happen, Here is what we did:</p>
<ol dir="auto">
<li>Take the picture and save the image in temporary location.</li>
<li>Pass the image uri into glide and resave the image again</li>
<li>Send final glide image to server</li>
</ol>
<p dir="auto">QUESTIONS:</p>
<ol dir="auto">
<li>Do i need to save the image twice? or is it possible for glide to load the taken photo from memory without having to temporarily save the file in order to obtain a file path location?</li>
<li>Is it possible to use simple targets to automatically put images in correct rotation when saving image to local storage? Images will be displayed on web, other social media outlets, android and ios app. So they need to be correctly oriented before sending to our server</li>
<li>If number 2 is not possible are there any advantages of saving the image file with Glide Simple Targets?</li>
</ol>
<p dir="auto">Please see my attached code</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="private class CameraPhotoImageTask extends AsyncTask&lt;String, Void, Bitmap&gt; {
        int h=0;
        int w=0;
        private File imageFile = null;
        private File temporaryImageFile = null;

        public CameraPhotoImageTask() {
        }

        protected Bitmap doInBackground(String... urls) {
            /* Image taken is represented into byte array and passed into &quot;urls&quot; array.
             We will first convert byte array from urls[] into bitmap image called &quot;loadedImage&quot; */
            //
            Bitmap loadedImage = null;
            byte[] decodedString = android.util.Base64.decode(urls[0], android.util.Base64.DEFAULT);
            loadedImage = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);

            // Get the height and width of loadedImage. We will need this to pass into Glide
             w = loadedImage.getWidth();
             h = loadedImage.getHeight();
            Log.i(&quot;Test&quot;, &quot;Chosen resolution: &quot; + w + &quot;, &quot; + h);

            /*Here we will temporarily save the bitmap image(loadedImage) into a temporary file and directory
             so that we can pass it to glide for processing. */
            try {
                     ByteArrayOutputStream ostream = new ByteArrayOutputStream();
                     loadedImage.compress(CompressFormat.JPEG, 70, ostream);
                     temporaryImageFile = makeFilewithDir(AppTools.PHOTO_DIR,temporaryImageFile);

                     if (temporaryImageFile == null) {
                         Toast.makeText(getBaseContext(), &quot;Image Not saved&quot;,
                                 Toast.LENGTH_SHORT).show();
                     }

                     FileOutputStream fout = new FileOutputStream(temporaryImageFile);
                     fout.write(ostream.toByteArray());
                     fout.close();

                 }catch (Exception e) {
                 e.printStackTrace();
                 }

            /*Now we need to get the directory path of the temporary image file and represent it as a uri
            before loading it into glide for processing */
            final File tempFile = new File(temporaryImageFile.getPath().toString());
            Uri imageUri = Uri.fromFile(tempFile);
            Log.i(&quot;Test&quot;, &quot;loaded image is &quot; +imageUri);


            // Now we can pass the imageURI file path into Glide and process the image into a newBitmap from Glide
            //WARNING!!!!: Glide .into does not work on background thread. So we need to put it into UI thread before calling .into
            CameraDemoActivity.this.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    final File tempFile = new File(temporaryImageFile.getPath().toString());
                    Uri imageUri = Uri.fromFile(tempFile);
                //Pass imageUri into Glide
                    Glide.with(getApplicationContext())// Need to use Application Context
                            .load(imageUri)
                            .asBitmap()
                            .diskCacheStrategy(DiskCacheStrategy.ALL)
                            .centerCrop()
                            .into(new SimpleTarget&lt;Bitmap&gt;(w, h) {
                                @Override
                                public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
                            /*Assign the newly converted bitmap to newImageFromGlide then save the location of the bitmap
                            to our local database. Reminder: Need to delete the temporaryImageFile once newBitmap from
                            Glide is saved will handle this later*/
                                    try {
                                        ByteArrayOutputStream ostream = new ByteArrayOutputStream();
                                        Bitmap newImageFromGlide = bitmap;
                                        newImageFromGlide.compress(CompressFormat.JPEG, 70, ostream);

                                        imageFile = makeFilewithDir(AppTools.PHOTO_DIR, imageFile);

                                        if (imageFile == null) {
                                            Toast.makeText(getBaseContext(), &quot;Image Not saved&quot;,
                                                    Toast.LENGTH_SHORT).show();
                                        }
                                        FileOutputStream fout = new FileOutputStream(imageFile);
                                        fout.write(ostream.toByteArray());
                                        fout.close();
                                        ContentValues values = new ContentValues();
                                        values.put(MediaStore.Images.Media.DATE_TAKEN,
                                                System.currentTimeMillis());
                                        values.put(MediaStore.Images.Media.MIME_TYPE, &quot;image/jpeg&quot;);
                                        values.put(MediaStore.MediaColumns.DATA,
                                                imageFile.getAbsolutePath());

                                        CameraDemoActivity.this.getContentResolver().insert(
                                                MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

                                        //We need to load the image into the active status and set local database parameters for the image
                                        Log.i(&quot;Test&quot;, &quot;loaded image is &quot; +&quot;Now we are taking&quot;);
                                        Cursor activeStatus = myStatus.getActiveStatus();
                                        if (activeStatus.getCount() &gt; 0) {
                                            activeStatus.moveToFirst();
                                            final int id = activeStatus.getInt(activeStatus.getColumnIndex(myStatus.COLUMN_ID));
                                            MyStatusMediaDB.insertMedia(id, 1, imageFile.getPath().toString(), &quot;&quot;, 0, &quot;&quot;, &quot;&quot;);
                                        }
                                        activeStatus.close();
                                        if (newImageFromGlide != null) {
                                            newImageFromGlide.recycle();
                                            newImageFromGlide = null;
                                        }


                                        CameraDemoActivity.this.runOnUiThread(new Runnable() {
                                            @Override
                                            public void run() {
                                                captureImage.setEnabled(true);
                                            }
                                        });
                                    } catch (Exception e) {
                                        e.printStackTrace();
                                        CameraDemoActivity.this.runOnUiThread(new Runnable() {
                                            @Override
                                            public void run() {
                                                captureImage.setEnabled(true);
                                            }
                                        });
                                    }

                                    CameraDemoActivity.this.runOnUiThread(new Runnable() {
                                        @Override
                                        public void run() {
                                            captureImage.setEnabled(true);
                                        }
                                    });
                                }});  //End of Glide
                }
            });"><pre class="notranslate"><span class="pl-k">private</span> <span class="pl-k">class</span> <span class="pl-smi">CameraPhotoImageTask</span> <span class="pl-k">extends</span> <span class="pl-smi">AsyncTask</span>&lt;<span class="pl-smi">String</span>, <span class="pl-smi">Void</span>, <span class="pl-smi">Bitmap</span>&gt; {
        <span class="pl-smi">int</span> <span class="pl-s1">h</span>=<span class="pl-c1">0</span>;
        <span class="pl-smi">int</span> <span class="pl-s1">w</span>=<span class="pl-c1">0</span>;
        <span class="pl-k">private</span> <span class="pl-smi">File</span> <span class="pl-s1">imageFile</span> = <span class="pl-c1">null</span>;
        <span class="pl-k">private</span> <span class="pl-smi">File</span> <span class="pl-s1">temporaryImageFile</span> = <span class="pl-c1">null</span>;

        <span class="pl-k">public</span> <span class="pl-smi">CameraPhotoImageTask</span>() {
        }

        <span class="pl-k">protected</span> <span class="pl-smi">Bitmap</span> <span class="pl-en">doInBackground</span>(<span class="pl-smi">String</span>... <span class="pl-s1">urls</span>) {
            <span class="pl-c">/* Image taken is represented into byte array and passed into "urls" array.</span>
<span class="pl-c">             We will first convert byte array from urls[] into bitmap image called "loadedImage" */</span>
            <span class="pl-c">//</span>
            <span class="pl-smi">Bitmap</span> <span class="pl-s1">loadedImage</span> = <span class="pl-c1">null</span>;
            <span class="pl-smi">byte</span>[] <span class="pl-s1">decodedString</span> = <span class="pl-s1">android</span>.<span class="pl-s1">util</span>.<span class="pl-s1">Base64</span>.<span class="pl-en">decode</span>(<span class="pl-s1">urls</span>[<span class="pl-c1">0</span>], <span class="pl-s1">android</span>.<span class="pl-s1">util</span>.<span class="pl-s1">Base64</span>.<span class="pl-c1">DEFAULT</span>);
            <span class="pl-s1">loadedImage</span> = <span class="pl-smi">BitmapFactory</span>.<span class="pl-en">decodeByteArray</span>(<span class="pl-s1">decodedString</span>, <span class="pl-c1">0</span>, <span class="pl-s1">decodedString</span>.<span class="pl-s1">length</span>);

            <span class="pl-c">// Get the height and width of loadedImage. We will need this to pass into Glide</span>
             <span class="pl-s1">w</span> = <span class="pl-s1">loadedImage</span>.<span class="pl-en">getWidth</span>();
             <span class="pl-s1">h</span> = <span class="pl-s1">loadedImage</span>.<span class="pl-en">getHeight</span>();
            <span class="pl-smi">Log</span>.<span class="pl-en">i</span>(<span class="pl-s">"Test"</span>, <span class="pl-s">"Chosen resolution: "</span> + <span class="pl-s1">w</span> + <span class="pl-s">", "</span> + <span class="pl-s1">h</span>);

            <span class="pl-c">/*Here we will temporarily save the bitmap image(loadedImage) into a temporary file and directory</span>
<span class="pl-c">             so that we can pass it to glide for processing. */</span>
            <span class="pl-k">try</span> {
                     <span class="pl-smi">ByteArrayOutputStream</span> <span class="pl-s1">ostream</span> = <span class="pl-k">new</span> <span class="pl-smi">ByteArrayOutputStream</span>();
                     <span class="pl-s1">loadedImage</span>.<span class="pl-en">compress</span>(<span class="pl-smi">CompressFormat</span>.<span class="pl-c1">JPEG</span>, <span class="pl-c1">70</span>, <span class="pl-s1">ostream</span>);
                     <span class="pl-s1">temporaryImageFile</span> = <span class="pl-en">makeFilewithDir</span>(<span class="pl-smi">AppTools</span>.<span class="pl-c1">PHOTO_DIR</span>,<span class="pl-s1">temporaryImageFile</span>);

                     <span class="pl-k">if</span> (<span class="pl-s1">temporaryImageFile</span> == <span class="pl-c1">null</span>) {
                         <span class="pl-smi">Toast</span>.<span class="pl-en">makeText</span>(<span class="pl-en">getBaseContext</span>(), <span class="pl-s">"Image Not saved"</span>,
                                 <span class="pl-smi">Toast</span>.<span class="pl-c1">LENGTH_SHORT</span>).<span class="pl-en">show</span>();
                     }

                     <span class="pl-smi">FileOutputStream</span> <span class="pl-s1">fout</span> = <span class="pl-k">new</span> <span class="pl-smi">FileOutputStream</span>(<span class="pl-s1">temporaryImageFile</span>);
                     <span class="pl-s1">fout</span>.<span class="pl-en">write</span>(<span class="pl-s1">ostream</span>.<span class="pl-en">toByteArray</span>());
                     <span class="pl-s1">fout</span>.<span class="pl-en">close</span>();

                 }<span class="pl-k">catch</span> (<span class="pl-smi">Exception</span> <span class="pl-s1">e</span>) {
                 <span class="pl-s1">e</span>.<span class="pl-en">printStackTrace</span>();
                 }

            <span class="pl-c">/*Now we need to get the directory path of the temporary image file and represent it as a uri</span>
<span class="pl-c">            before loading it into glide for processing */</span>
            <span class="pl-k">final</span> <span class="pl-smi">File</span> <span class="pl-s1">tempFile</span> = <span class="pl-k">new</span> <span class="pl-smi">File</span>(<span class="pl-s1">temporaryImageFile</span>.<span class="pl-en">getPath</span>().<span class="pl-en">toString</span>());
            <span class="pl-smi">Uri</span> <span class="pl-s1">imageUri</span> = <span class="pl-smi">Uri</span>.<span class="pl-en">fromFile</span>(<span class="pl-s1">tempFile</span>);
            <span class="pl-smi">Log</span>.<span class="pl-en">i</span>(<span class="pl-s">"Test"</span>, <span class="pl-s">"loaded image is "</span> +<span class="pl-s1">imageUri</span>);


            <span class="pl-c">// Now we can pass the imageURI file path into Glide and process the image into a newBitmap from Glide</span>
            <span class="pl-c">//WARNING!!!!: Glide .into does not work on background thread. So we need to put it into UI thread before calling .into</span>
            <span class="pl-smi">CameraDemoActivity</span>.<span class="pl-smi">this</span>.<span class="pl-en">runOnUiThread</span>(<span class="pl-k">new</span> <span class="pl-smi">Runnable</span>() {
                <span class="pl-c1">@</span><span class="pl-c1">Override</span>
                <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">run</span>() {
                    <span class="pl-k">final</span> <span class="pl-smi">File</span> <span class="pl-s1">tempFile</span> = <span class="pl-k">new</span> <span class="pl-smi">File</span>(<span class="pl-s1">temporaryImageFile</span>.<span class="pl-en">getPath</span>().<span class="pl-en">toString</span>());
                    <span class="pl-smi">Uri</span> <span class="pl-s1">imageUri</span> = <span class="pl-smi">Uri</span>.<span class="pl-en">fromFile</span>(<span class="pl-s1">tempFile</span>);
                <span class="pl-c">//Pass imageUri into Glide</span>
                    <span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-en">getApplicationContext</span>())<span class="pl-c">// Need to use Application Context</span>
                            .<span class="pl-en">load</span>(<span class="pl-s1">imageUri</span>)
                            .<span class="pl-en">asBitmap</span>()
                            .<span class="pl-en">diskCacheStrategy</span>(<span class="pl-smi">DiskCacheStrategy</span>.<span class="pl-c1">ALL</span>)
                            .<span class="pl-en">centerCrop</span>()
                            .<span class="pl-en">into</span>(<span class="pl-k">new</span> <span class="pl-smi">SimpleTarget</span>&lt;<span class="pl-smi">Bitmap</span>&gt;(<span class="pl-s1">w</span>, <span class="pl-s1">h</span>) {
                                <span class="pl-c1">@</span><span class="pl-c1">Override</span>
                                <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">onResourceReady</span>(<span class="pl-smi">Bitmap</span> <span class="pl-s1">bitmap</span>, <span class="pl-smi">GlideAnimation</span> <span class="pl-s1">anim</span>) {
                            <span class="pl-c">/*Assign the newly converted bitmap to newImageFromGlide then save the location of the bitmap</span>
<span class="pl-c">                            to our local database. Reminder: Need to delete the temporaryImageFile once newBitmap from</span>
<span class="pl-c">                            Glide is saved will handle this later*/</span>
                                    <span class="pl-k">try</span> {
                                        <span class="pl-smi">ByteArrayOutputStream</span> <span class="pl-s1">ostream</span> = <span class="pl-k">new</span> <span class="pl-smi">ByteArrayOutputStream</span>();
                                        <span class="pl-smi">Bitmap</span> <span class="pl-s1">newImageFromGlide</span> = <span class="pl-s1">bitmap</span>;
                                        <span class="pl-s1">newImageFromGlide</span>.<span class="pl-en">compress</span>(<span class="pl-smi">CompressFormat</span>.<span class="pl-c1">JPEG</span>, <span class="pl-c1">70</span>, <span class="pl-s1">ostream</span>);

                                        <span class="pl-s1">imageFile</span> = <span class="pl-en">makeFilewithDir</span>(<span class="pl-smi">AppTools</span>.<span class="pl-c1">PHOTO_DIR</span>, <span class="pl-s1">imageFile</span>);

                                        <span class="pl-k">if</span> (<span class="pl-s1">imageFile</span> == <span class="pl-c1">null</span>) {
                                            <span class="pl-smi">Toast</span>.<span class="pl-en">makeText</span>(<span class="pl-en">getBaseContext</span>(), <span class="pl-s">"Image Not saved"</span>,
                                                    <span class="pl-smi">Toast</span>.<span class="pl-c1">LENGTH_SHORT</span>).<span class="pl-en">show</span>();
                                        }
                                        <span class="pl-smi">FileOutputStream</span> <span class="pl-s1">fout</span> = <span class="pl-k">new</span> <span class="pl-smi">FileOutputStream</span>(<span class="pl-s1">imageFile</span>);
                                        <span class="pl-s1">fout</span>.<span class="pl-en">write</span>(<span class="pl-s1">ostream</span>.<span class="pl-en">toByteArray</span>());
                                        <span class="pl-s1">fout</span>.<span class="pl-en">close</span>();
                                        <span class="pl-smi">ContentValues</span> <span class="pl-s1">values</span> = <span class="pl-k">new</span> <span class="pl-smi">ContentValues</span>();
                                        <span class="pl-s1">values</span>.<span class="pl-en">put</span>(<span class="pl-smi">MediaStore</span>.<span class="pl-s1">Images</span>.<span class="pl-s1">Media</span>.<span class="pl-c1">DATE_TAKEN</span>,
                                                <span class="pl-smi">System</span>.<span class="pl-en">currentTimeMillis</span>());
                                        <span class="pl-s1">values</span>.<span class="pl-en">put</span>(<span class="pl-smi">MediaStore</span>.<span class="pl-s1">Images</span>.<span class="pl-s1">Media</span>.<span class="pl-c1">MIME_TYPE</span>, <span class="pl-s">"image/jpeg"</span>);
                                        <span class="pl-s1">values</span>.<span class="pl-en">put</span>(<span class="pl-smi">MediaStore</span>.<span class="pl-s1">MediaColumns</span>.<span class="pl-c1">DATA</span>,
                                                <span class="pl-s1">imageFile</span>.<span class="pl-en">getAbsolutePath</span>());

                                        <span class="pl-smi">CameraDemoActivity</span>.<span class="pl-smi">this</span>.<span class="pl-en">getContentResolver</span>().<span class="pl-en">insert</span>(
                                                <span class="pl-smi">MediaStore</span>.<span class="pl-s1">Images</span>.<span class="pl-s1">Media</span>.<span class="pl-c1">EXTERNAL_CONTENT_URI</span>, <span class="pl-s1">values</span>);

                                        <span class="pl-c">//We need to load the image into the active status and set local database parameters for the image</span>
                                        <span class="pl-smi">Log</span>.<span class="pl-en">i</span>(<span class="pl-s">"Test"</span>, <span class="pl-s">"loaded image is "</span> +<span class="pl-s">"Now we are taking"</span>);
                                        <span class="pl-smi">Cursor</span> <span class="pl-s1">activeStatus</span> = <span class="pl-s1">myStatus</span>.<span class="pl-en">getActiveStatus</span>();
                                        <span class="pl-k">if</span> (<span class="pl-s1">activeStatus</span>.<span class="pl-en">getCount</span>() &gt; <span class="pl-c1">0</span>) {
                                            <span class="pl-s1">activeStatus</span>.<span class="pl-en">moveToFirst</span>();
                                            <span class="pl-k">final</span> <span class="pl-smi">int</span> <span class="pl-s1">id</span> = <span class="pl-s1">activeStatus</span>.<span class="pl-en">getInt</span>(<span class="pl-s1">activeStatus</span>.<span class="pl-en">getColumnIndex</span>(<span class="pl-s1">myStatus</span>.<span class="pl-c1">COLUMN_ID</span>));
                                            <span class="pl-smi">MyStatusMediaDB</span>.<span class="pl-en">insertMedia</span>(<span class="pl-s1">id</span>, <span class="pl-c1">1</span>, <span class="pl-s1">imageFile</span>.<span class="pl-en">getPath</span>().<span class="pl-en">toString</span>(), <span class="pl-s">""</span>, <span class="pl-c1">0</span>, <span class="pl-s">""</span>, <span class="pl-s">""</span>);
                                        }
                                        <span class="pl-s1">activeStatus</span>.<span class="pl-en">close</span>();
                                        <span class="pl-k">if</span> (<span class="pl-s1">newImageFromGlide</span> != <span class="pl-c1">null</span>) {
                                            <span class="pl-s1">newImageFromGlide</span>.<span class="pl-en">recycle</span>();
                                            <span class="pl-s1">newImageFromGlide</span> = <span class="pl-c1">null</span>;
                                        }


                                        <span class="pl-smi">CameraDemoActivity</span>.<span class="pl-smi">this</span>.<span class="pl-en">runOnUiThread</span>(<span class="pl-k">new</span> <span class="pl-smi">Runnable</span>() {
                                            <span class="pl-c1">@</span><span class="pl-c1">Override</span>
                                            <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">run</span>() {
                                                <span class="pl-s1">captureImage</span>.<span class="pl-en">setEnabled</span>(<span class="pl-c1">true</span>);
                                            }
                                        });
                                    } <span class="pl-k">catch</span> (<span class="pl-smi">Exception</span> <span class="pl-s1">e</span>) {
                                        <span class="pl-s1">e</span>.<span class="pl-en">printStackTrace</span>();
                                        <span class="pl-smi">CameraDemoActivity</span>.<span class="pl-smi">this</span>.<span class="pl-en">runOnUiThread</span>(<span class="pl-k">new</span> <span class="pl-smi">Runnable</span>() {
                                            <span class="pl-c1">@</span><span class="pl-c1">Override</span>
                                            <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">run</span>() {
                                                <span class="pl-s1">captureImage</span>.<span class="pl-en">setEnabled</span>(<span class="pl-c1">true</span>);
                                            }
                                        });
                                    }

                                    <span class="pl-smi">CameraDemoActivity</span>.<span class="pl-smi">this</span>.<span class="pl-en">runOnUiThread</span>(<span class="pl-k">new</span> <span class="pl-smi">Runnable</span>() {
                                        <span class="pl-c1">@</span><span class="pl-c1">Override</span>
                                        <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">run</span>() {
                                            <span class="pl-s1">captureImage</span>.<span class="pl-en">setEnabled</span>(<span class="pl-c1">true</span>);
                                        }
                                    });
                                }});  <span class="pl-c">//End of Glide</span>
                }
            });</pre></div>