getting error with Glide assert: java.lang.IllegalArgumentException: You must call this method on the main thread'Must Override a Superclass Method' Errors after importing a project into EclipseMipmap drawables for iconsHow to load image through byte array using Glide?Glide assert: java.lang.IllegalArgumentException: You must call this method on the main threadGlide error: java.lang.IllegalArgumentException - You must call this method on a background threadGetting context for Glide, within a fragment, results in errorLoad dynamically created bitmaps with GlideHow to show images to RecycleView using Glide?How to convert a bitmap or byte array to an image?How to draw image set in an image view by glide on the canvas in Android?

What can plausibly explain many of my very long and low-tech bridges?

What makes Ada the language of choice for the ISS's safety-critical systems?

Where does "0 packages can be updated." come from?

Was Jesus good at singing?

Do any instruments not produce overtones?

Find the Factorial From the Given Prime Relationship

How to tell your grandparent to not come to fetch you with their car?

Find duplicated column value in CSV

Is an early checkout possible at a hotel before its reception opens?

Does an ice chest packed full of frozen food need ice?

Winning Strategy for the Magician and his Apprentice

How Can I Tell The Difference Between Unmarked Sugar and Stevia?

Does Disney no longer produce hand-drawn cartoon films?

Preventing Employees from either switching to Competitors or Opening Their Own Business

Genetic limitations to learn certain instruments

Can the poison from Kingsmen be concocted?

Compiling c files on ubuntu and using the executable on Windows

Why only the fundamental frequency component is said to give useful power?

Arriving at the same result with the opposite hypotheses

Was there a priest on the Titanic who stayed on the ship giving confession to as many as he could?

Is it possible to 'live off the sea'

The eyes have it

What's up with this leaf?

How does an ordinary object become radioactive?



getting error with Glide assert: java.lang.IllegalArgumentException: You must call this method on the main thread


'Must Override a Superclass Method' Errors after importing a project into EclipseMipmap drawables for iconsHow to load image through byte array using Glide?Glide assert: java.lang.IllegalArgumentException: You must call this method on the main threadGlide error: java.lang.IllegalArgumentException - You must call this method on a background threadGetting context for Glide, within a fragment, results in errorLoad dynamically created bitmaps with GlideHow to show images to RecycleView using Glide?How to convert a bitmap or byte array to an image?How to draw image set in an image view by glide on the canvas in Android?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















i want to get the bitmap from url and then want to convert it into byte array for storing it into sqlite, i am using the glide for getting the bitmap from url here is my code



Bitmap temp = null;
Bitmap temp2 = null;
try
temp = Glide.with(this)
.load(urlNavHeaderBg)
.asBitmap()
.into(-1, -1)
.get();

temp2 = Glide.with(this)
.load(profile_pic_url)
.asBitmap()
.into(-1, -1)
.get();
catch (InterruptedException e)
e.printStackTrace();
catch (ExecutionException e)
e.printStackTrace();



if anyone having better idea to get bitmap and convert it into byte array then feel free to suggest










share|improve this question






























    0















    i want to get the bitmap from url and then want to convert it into byte array for storing it into sqlite, i am using the glide for getting the bitmap from url here is my code



    Bitmap temp = null;
    Bitmap temp2 = null;
    try
    temp = Glide.with(this)
    .load(urlNavHeaderBg)
    .asBitmap()
    .into(-1, -1)
    .get();

    temp2 = Glide.with(this)
    .load(profile_pic_url)
    .asBitmap()
    .into(-1, -1)
    .get();
    catch (InterruptedException e)
    e.printStackTrace();
    catch (ExecutionException e)
    e.printStackTrace();



    if anyone having better idea to get bitmap and convert it into byte array then feel free to suggest










    share|improve this question


























      0












      0








      0








      i want to get the bitmap from url and then want to convert it into byte array for storing it into sqlite, i am using the glide for getting the bitmap from url here is my code



      Bitmap temp = null;
      Bitmap temp2 = null;
      try
      temp = Glide.with(this)
      .load(urlNavHeaderBg)
      .asBitmap()
      .into(-1, -1)
      .get();

      temp2 = Glide.with(this)
      .load(profile_pic_url)
      .asBitmap()
      .into(-1, -1)
      .get();
      catch (InterruptedException e)
      e.printStackTrace();
      catch (ExecutionException e)
      e.printStackTrace();



      if anyone having better idea to get bitmap and convert it into byte array then feel free to suggest










      share|improve this question
















      i want to get the bitmap from url and then want to convert it into byte array for storing it into sqlite, i am using the glide for getting the bitmap from url here is my code



      Bitmap temp = null;
      Bitmap temp2 = null;
      try
      temp = Glide.with(this)
      .load(urlNavHeaderBg)
      .asBitmap()
      .into(-1, -1)
      .get();

      temp2 = Glide.with(this)
      .load(profile_pic_url)
      .asBitmap()
      .into(-1, -1)
      .get();
      catch (InterruptedException e)
      e.printStackTrace();
      catch (ExecutionException e)
      e.printStackTrace();



      if anyone having better idea to get bitmap and convert it into byte array then feel free to suggest







      android android-glide






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 24 at 16:28









      Zoe

      15.2k85789




      15.2k85789










      asked Sep 21 '17 at 9:17









      Nikhil PatilNikhil Patil

      245




      245






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Try this instead



           Glide.with(this)
          .load(urlNavHeaderBg)
          .asBitmap()
          .placeholder(R.drawable.place_holder_image)
          .error(R.drawable.place_holder_image)
          .into(new SimpleTarget<Bitmap>()
          @Override
          public void onResourceReady(final Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation)
          Bitmap bimtapImage=resource;
          //Convert this bimtapImage to byte array

          @Override
          public void onLoadFailed(Exception e, Drawable errorDrawable)
          super.onLoadFailed(e, errorDrawable);

          );





          share|improve this answer

























          • how can i get bitmap of that image from this as i want to convert it into bytearray

            – Nikhil Patil
            Sep 21 '17 at 9:24











          • Bitmap resource inside onResourceReady gives you image in bitmap only

            – sharath kumar
            Sep 21 '17 at 9:25












          • so in onResourceReady methode i create one bitmap variable and assign it Bitmap resource object?

            – Nikhil Patil
            Sep 21 '17 at 9:28











          • Updated..check that

            – sharath kumar
            Sep 21 '17 at 9:31











          • Thanks, i will test it and report back to you

            – Nikhil Patil
            Sep 21 '17 at 9:36











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46340005%2fgetting-error-with-glide-assert-java-lang-illegalargumentexception-you-must-ca%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Try this instead



           Glide.with(this)
          .load(urlNavHeaderBg)
          .asBitmap()
          .placeholder(R.drawable.place_holder_image)
          .error(R.drawable.place_holder_image)
          .into(new SimpleTarget<Bitmap>()
          @Override
          public void onResourceReady(final Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation)
          Bitmap bimtapImage=resource;
          //Convert this bimtapImage to byte array

          @Override
          public void onLoadFailed(Exception e, Drawable errorDrawable)
          super.onLoadFailed(e, errorDrawable);

          );





          share|improve this answer

























          • how can i get bitmap of that image from this as i want to convert it into bytearray

            – Nikhil Patil
            Sep 21 '17 at 9:24











          • Bitmap resource inside onResourceReady gives you image in bitmap only

            – sharath kumar
            Sep 21 '17 at 9:25












          • so in onResourceReady methode i create one bitmap variable and assign it Bitmap resource object?

            – Nikhil Patil
            Sep 21 '17 at 9:28











          • Updated..check that

            – sharath kumar
            Sep 21 '17 at 9:31











          • Thanks, i will test it and report back to you

            – Nikhil Patil
            Sep 21 '17 at 9:36















          0














          Try this instead



           Glide.with(this)
          .load(urlNavHeaderBg)
          .asBitmap()
          .placeholder(R.drawable.place_holder_image)
          .error(R.drawable.place_holder_image)
          .into(new SimpleTarget<Bitmap>()
          @Override
          public void onResourceReady(final Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation)
          Bitmap bimtapImage=resource;
          //Convert this bimtapImage to byte array

          @Override
          public void onLoadFailed(Exception e, Drawable errorDrawable)
          super.onLoadFailed(e, errorDrawable);

          );





          share|improve this answer

























          • how can i get bitmap of that image from this as i want to convert it into bytearray

            – Nikhil Patil
            Sep 21 '17 at 9:24











          • Bitmap resource inside onResourceReady gives you image in bitmap only

            – sharath kumar
            Sep 21 '17 at 9:25












          • so in onResourceReady methode i create one bitmap variable and assign it Bitmap resource object?

            – Nikhil Patil
            Sep 21 '17 at 9:28











          • Updated..check that

            – sharath kumar
            Sep 21 '17 at 9:31











          • Thanks, i will test it and report back to you

            – Nikhil Patil
            Sep 21 '17 at 9:36













          0












          0








          0







          Try this instead



           Glide.with(this)
          .load(urlNavHeaderBg)
          .asBitmap()
          .placeholder(R.drawable.place_holder_image)
          .error(R.drawable.place_holder_image)
          .into(new SimpleTarget<Bitmap>()
          @Override
          public void onResourceReady(final Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation)
          Bitmap bimtapImage=resource;
          //Convert this bimtapImage to byte array

          @Override
          public void onLoadFailed(Exception e, Drawable errorDrawable)
          super.onLoadFailed(e, errorDrawable);

          );





          share|improve this answer















          Try this instead



           Glide.with(this)
          .load(urlNavHeaderBg)
          .asBitmap()
          .placeholder(R.drawable.place_holder_image)
          .error(R.drawable.place_holder_image)
          .into(new SimpleTarget<Bitmap>()
          @Override
          public void onResourceReady(final Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation)
          Bitmap bimtapImage=resource;
          //Convert this bimtapImage to byte array

          @Override
          public void onLoadFailed(Exception e, Drawable errorDrawable)
          super.onLoadFailed(e, errorDrawable);

          );






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 21 '17 at 9:31

























          answered Sep 21 '17 at 9:19









          sharath kumarsharath kumar

          3,0311616




          3,0311616












          • how can i get bitmap of that image from this as i want to convert it into bytearray

            – Nikhil Patil
            Sep 21 '17 at 9:24











          • Bitmap resource inside onResourceReady gives you image in bitmap only

            – sharath kumar
            Sep 21 '17 at 9:25












          • so in onResourceReady methode i create one bitmap variable and assign it Bitmap resource object?

            – Nikhil Patil
            Sep 21 '17 at 9:28











          • Updated..check that

            – sharath kumar
            Sep 21 '17 at 9:31











          • Thanks, i will test it and report back to you

            – Nikhil Patil
            Sep 21 '17 at 9:36

















          • how can i get bitmap of that image from this as i want to convert it into bytearray

            – Nikhil Patil
            Sep 21 '17 at 9:24











          • Bitmap resource inside onResourceReady gives you image in bitmap only

            – sharath kumar
            Sep 21 '17 at 9:25












          • so in onResourceReady methode i create one bitmap variable and assign it Bitmap resource object?

            – Nikhil Patil
            Sep 21 '17 at 9:28











          • Updated..check that

            – sharath kumar
            Sep 21 '17 at 9:31











          • Thanks, i will test it and report back to you

            – Nikhil Patil
            Sep 21 '17 at 9:36
















          how can i get bitmap of that image from this as i want to convert it into bytearray

          – Nikhil Patil
          Sep 21 '17 at 9:24





          how can i get bitmap of that image from this as i want to convert it into bytearray

          – Nikhil Patil
          Sep 21 '17 at 9:24













          Bitmap resource inside onResourceReady gives you image in bitmap only

          – sharath kumar
          Sep 21 '17 at 9:25






          Bitmap resource inside onResourceReady gives you image in bitmap only

          – sharath kumar
          Sep 21 '17 at 9:25














          so in onResourceReady methode i create one bitmap variable and assign it Bitmap resource object?

          – Nikhil Patil
          Sep 21 '17 at 9:28





          so in onResourceReady methode i create one bitmap variable and assign it Bitmap resource object?

          – Nikhil Patil
          Sep 21 '17 at 9:28













          Updated..check that

          – sharath kumar
          Sep 21 '17 at 9:31





          Updated..check that

          – sharath kumar
          Sep 21 '17 at 9:31













          Thanks, i will test it and report back to you

          – Nikhil Patil
          Sep 21 '17 at 9:36





          Thanks, i will test it and report back to you

          – Nikhil Patil
          Sep 21 '17 at 9:36



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46340005%2fgetting-error-with-glide-assert-java-lang-illegalargumentexception-you-must-ca%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript